JavaScript is a scripting language written in c++ and a high level language.

History

JavaScript called as JS often. It was created by Brendan Eich. First release was on 04 Dec 1995.

Main purpose:

With HTML and CSS we can create a static webpage only. JS is used for dynamic webpage. Now JavaScript has evolved in many ways. Initially it has been used for client side scripting on Browsers only. The only possible way to run the JS was Browser. Now we can use this in Runtime environment called NodeJS as server side scripting language. Now the JavaScript is server and client side scripting.

How to run JavaScript code?

Running JavaScript code is very easy. You could run it directly on broweser or can run it via JS extension file.

  1. Open your browser's developer console and just start typing JS.
  2. Save JS code in a file with the extension .js . In the HTML file's script tag mention the file path. For example,
  • Create a file main.js and fill it with JS codes
  • alert("Hello from JS")
  • In the same folder create another file index.html and fill it with HTML
  • In index.html file add this code on head tag
  • <script src="./main.js"/>
  • Now double click the HTML file
  • Your website will be loaded on your default Browser