ECMAScript is an object-oriented programming language for performing computations and manipulating objects within a host environment(normally web browser).

ECMAScript was called a script language which is used to manipulate, customise and automatic the facilities of existing system.

Language Preview

Object is collection of properties each with zero or more attributes that determine how each property can be used.

Property can be: other object, primary value or function.

Primary value is a member of following built-in types: undefined, null, boolean, number, string.

Function is callable object. A function which is associated with an object via property is a method.

ECMAScript defines a collection of built-in objects:

  • global object.
  • Object object.
  • Function object.
  • Array object.
  • String object.
  • Number object.
  • Boolean object.
  • Math object.
  • Date object.
  • Error object.

ECMAScript also defined a set of built-in operators: unary operators, multiplicative operators, additive operators, bitwise operators, relational operators, equality operators, binary logical operators, assigment operators and comma operators.

  • comma operator: evaluates each of its operands(from left to right) and return the value of the last operand.

Object may be created in various ways including via:

  • literal notation.
  • constructor which create objects and then execute the code that intialises all or part of them by assigning intial value for their properties.

Each of constructor is a function that has prorperty named prototype which is used to implement prototype-based inheritance or shared objects.

Object was created by using constructor in new expressions. Invoking constructor without new has consequences that depend on the constructor.

Object was created by using constructor has an implicit reference to the value of its constructor's prototype property. Furthermore, a prototype may have a non-null implicit reference to its prototype and so on; this is call prototype chain. When a reference is made to property in an object, ECMAScript firstly looks up in this object if it doesn't have they keep looking up in prototype chain.

Strict Variant of ECMAScript

Some people wist to restrict their usage of some features available in the language. They might do so because of:

  1. security.
  2. to avoid what they consider to error-prone features.
  3. get enhanced in error checking(means it will throw error exceptions in situations that are not specified as errors by non-strict mode).
  4. other reason of their choosing.

Doing it by excluding some specific syntactic and semantic features of the regular ECMAScript and modified the detailed semantics of some features.

  • strict mode only applies when actually executing code that is defined within a strict mode code unit(means ECMAScript may be composed for both strict and non-strict mode).