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.
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.