What is JavaScript

JavaScript is a loosely-typed client side scripting language that executes in the user's browser. JavaScript interact with html elements (DOM elements) in order to make interactive web user interface.

JavaScript implements ECMAScript standards, which includes core features based on ECMA-262 specification as well as other features which are not based on ECMAScript standards.

JavaScript Example:

JavaScript can be used in various activities like data validation, display popup messages, handling different events of DOM elements, modifying style of DOM elements etc. The following sample form uses JavaScript to validate data and change color of form.








JavaScript History:

In early 1995, Brendan Eich from Netscape, took charge of design and implementation of a new language for non-java programmers to give access of newly added Java support in Netscape navigator.

Eich eventually decided that a loosely-typed scripting language suited the environment and audience, web designers and developers who needed to be able to tie into page elements (such as forms, or frames, or images) without a bytecode compiler or knowledge of object-oriented software design. The dynamic nature of the language led to it being named "LiveScript" but was quickly renamed to "JavaScript" Know more about JavaScript history.

JavaScript Engine:

JavaScript engine in the browser interprets, compiles and executes JavaScript code which is in a web page. It does memory management, JIT compilation, type system etc. Each browser includes different JavaScript engines.

Browser JavaScript Engine
Internet Explorer v9.0+ Chakra
Chrome V8
FireFox JagerMonkey
Opera v 14+ V8
Safari JavaScriptCore (Nitro)

Comparison with Server side Languages:

JavaScript is different when compared to server side languages like Java and C#.

The following table lists the differences.

C# Java JavaScript
Strongly-Typed Strongly-Typed Loosely-Typed
Static Static Dynamic
Classical Inheritance Classical Inheritance Prototypal
Classes Classes Functions
Constructors Constructors Functions
Methods Methods Functions

Taken from: crockford.com

Advantages of JavaScript:

  1. JavaScript is easy to learn.
  2. It executes on client's browser, so eliminates server side processing.
  3. It executes on any OS.
  4. JavaScript can be used with any type of web page e.g. PHP, ASP.NET, Perl etc.
  5. Performance of web page increases due to client side execution.
  6. JavaScript code can be minified to decrease loading time from server.
  7. Many JavaScript based application frameworks are available in the market to create Single page web applications e.g. ExtJS, AngularJS, KnockoutJS etc.