JavaScript abbreviated as JS is a lightweight, interpreted, or just-in-time compiled programming, scripting language used on the web pages with HTML. Now days web pages are not the only place where JavaScript is used. Many desktop and server programs like non-browser environments also use it, such as Node.js, Apache, Adobe Acrobat MongoDB and CouchDB use JavaScript as their programming language.


JavaScript and Java are completely different languages, both in concept and design.

JavaScript was invented by Brendan Eich in 1995, and became an ECMA standard in 1997.
ECMA-262 is the official name of the standard. ECMAScript is the official name of the language.


JavaScript is a prototype-based, multi-paradigm, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles.

JavaScript Syntax

Javascript can be implement in two way in the web page:

First: Inline – within the html page javascript is written.

Second: Externally – we link the external javscript file which is named with extension “.js”.

Example for First way:

<!DOCTYPE html>


<head><title>Internal Javascript code</title>

<script type="text/javascript">

document.write("Hello World from JavaScript!");




<h1>Hello World!</h1>

<script type="text/javascript">

document.write("Javascript code within body tag!");





the script is included directly in the markup using the <script> element that encloses the script.

Example for the Second way:

we create a javascript file naming hello.js and we will write these code in the file:


var x, y, z; // How to declare variables

x = 5; y = 6; // How to assign values

z = x + y; // How to compute values

we will not use <script> element because it is not needed and when we link the file the HTML page then we will use <script> element see below line:

<script type=”text/javascript” src=”hello.js”></script>

We can add this line inside head tag element and also in footer within body tag element.

You Must Learn More