Home What is JavaScript

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

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#JavaJavaScript
Strongly-TypedStrongly-TypedLoosely-Typed
StaticStaticDynamic
Classical InheritanceClassical InheritancePrototypal
ClassesClassesFunctions
ConstructorsConstructorsFunctions
MethodsMethodsFunctions

Advantages of JavaScript

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

What Can JavaScript Do?

JavaScript can change HTML attribute values.

In this case JavaScript changes the value of the src (source) attribute of an image.