Introduction to JavaScript (JS)
JavaScript, alternatively known as JS, is a scripting language widely used for client-side web development. It was the originating dialect of the ECMAScript standard and “ECMA-262” is the official JS standard. ECMAScript is a Standard for scripting languages. Languages like JS are based on the ECMAScript standard. ECMA Standard is based on several originating technologies, the most well known being JavaScript and JScript (Microsoft). ECMA means European Computer Manufacturer’s Association.
JS was influenced by many languages and was designed to look like Java, but be easier for non-programmers to work with. Although best known for its use in websites (as client-side scripting language), JS is also used to enable scripting access to objects embedded in other applications.
JS is used in millions of web pages to improve the design, validate forms, detect browsers, create cookies, and much more. JS is the most popular scripting language on the internet, and works in all major browsers, such as Mozilla Firefox, Google Chrome, Internet Explorer, Apple Safari and Opera. We can start with popular text editor such as Notepad++, Atom and Vim to write JS codes.
JS was designed to add interactivity to HTML pages and can be embedded directly into HTML pages. JS is an interpreted language and everyone can use it without purchasing a license. Java and JavaScript are two completely different languages in both concept and design. To know JS a basic understanding of the HTML is required.
Features of JS:
♦ JS gives HTML designers a programming tool – HTML authors are normally not programmers, but JS is a scripting language with a very simple syntax. Almost anyone can put small “snippets” of code into their HTML pages.
♦ JS can put dynamic text into an HTML page – A JS statement like this: document.write(“” + name + “”) can write a variable text into an HTML page.
♦ JS can react to events – JS code can be set to execute when something happens, like when a page has finished loading or when a user clicks on an HTML element.
♦ JS can read and write HTML elements – JS code can read and change the content of an HTML element.
♦ JS can be used to validate data – JS code can be used to validate form data before it is submitted to a server. This saves the server from extra processing.
♦ JS can be used to detect the visitor’s browser – JS code can be used to detect the visitor’s browser, and – depending on the browser – load another page specifically designed for that browser.
♦ JS can be used to create cookies – JS code can be used to store and retrieve information on the visitor’s computer.