
Javascript is a scripting language that was introduced to make web pages alive and be interactive with the user. The interaction is possible due to the programs or scripts written along with HTML. Javascript was introduced by Brendan Eich a Netscape employee. Javascript at its development phase was called Mocha and was first shipped with Netscape Navigator 2.0 as LiveScript. Finally, when Netscape Navigator 2.0 Beta 3 was released it was given the name Javascript. Javascript has come a long way ie from a client-side programming/frameworks (like Angular/React) to a server-side technology like NodeJS in 2009.
In the year 1996, a standards organization called ECMA (European Computer Manufacturers Association) International carved out standard specification called ECMAScript (ES) which all browser vendors could implement. And Javascript is the most well-known implementations of ES, while ActionScript (from Macromedia/Adobe Systems) and JScript (from Microsoft) are other implementations of ES.
Till date, ES has published nine versions and the latest one (9th version) was published in the year 2018.
ECMA Script's first three versions- ES1, ES2, ES3 were yearly updates whereas, ES4 was never released due to political disagreements. After a decade, ES5 was eventually released with several additions
ES5:
ES5 was released in 2009, ten years after the release of its previous version. Here is a list of features that have come with the es5 version.
The earlier versions of JS allow the usage of undeclared variables. But when the es5 ‘use strict’ feature is used, an error is reported.
Ex:
isArray(): This method checks if the object is an array or not and returns the result in true or false.
Ex:
forEach(): It executes the function for every element found in the array.
Ex:
Ex:
Ex:
Ex:
NOTE: This example is the same as iterating over every element to calculate the sum.
Ex:
Ex:
Ex:
Ex:
Ex:
You may also like: Difference Between Java And Javascript
Ex:
Ex:
Ex:
Ex:
The get method returns the value of a variable, and the set method sets the value of the variable.
Object.defineProperty(): This method lets the user define the property of an object and/or change its value.
JS has shown great progress in the recent years starting from 2015 by releasing ES6 version. With this release, Javascript has made a big achievement in making a developers life easy and reached the expectations of a modern programming language. Even after 4 years of the release, many newbies to JS are not so familiar with all the versions.
Below is a list of the features that have come with ES6 version:
Till ES5, JS has only function scope and global scope with the introduction of let keyword in ES6, JS can now have block scope.
Ex:
for...of is an alternative for both for...in and forEach() and loops iterable data structures like Arrays, Maps, Sets, and strings.
Ex:
Provides default values to function parameters if no value or undefined is passed.
Ex:
Rest Operator is used to handle function parameters. It uses three dots as its syntax (i.e …).
Ex:
Spread Operator is used with arrays and its syntax is exactly the same as that of Rest Operator (ie …). It is used to split the contents of an array.
Ex:
Destructuring helps in unpacking values from an array or an object.
Ex:
It allows embedded expressions, which makes print statements easy.
Ex:
Arrow Functions use => as its token and so are also called as Fat Arrow Functions. They are one line functions and are much like Lambda functions in programming languages like Java 8 and Python. Prior to =>, JS has a function keyword.
Ex:
Promises are introduced in ES6 to handle Asynchronous Programming in a more elegant way. Before Promises, async calls were handled by Callbacks. Promises resolved the Call Back Hell.
Ex:
The Objects in Javascript are based on Prototypes and follows Prototypal Inheritance. But in ES6 the keyword class is introduced that makes the approach very easy.
Ex:
ES7 or ECMAScript 2016 was released in the year 2016. This version gives suitable alternatives to already used functionalities.
ES7 added an exponentiation operator (**) to already JavaScript supported arithmetic operations like +,-,*. This operator raises the first operand to the power second operand.
Ex:
Returns true if an array includes a value, if not returns false.
Ex:
You may also like: Top 51 Javascript Interview Questions and Answers You Must Prepare in 2018
ES8 or ECMAScript 2017 was released in the year 2017. This version allows new methods of coding with JavaScript.
This method pads a string with another string at the beginning.
Ex:
This method pads a string with another string and makes the resulting string reach a given length. It adds spaces at the end of the string.
Ex:
Await operator, applied only inside an async function, waits to be rejected or resolved by a promise.
It returns an array that contains the key-value pairs of a given object as an array.
Ex:
A trailing comma is simply a comma that comes at the end of the last item in a list.
Ex:
The same data can be read and written on multiple threads using the SharedArrayBuffer constructor. Interruption during the process of reading or writing can be avoided by using Atomic objects. This allows the previous operation to finish prior to the next one.
An object is returned to the own property descriptors with get, set, writeable, configurable and enumerable attributes.
Ex:
It returns an array of a given object’s own enumerable property values.
Ex:
ES9 or ECMAScript 2018 is the latest update and was released in the year 2018.
An async iterable object can be used as a loop iteration with the help of for-await-of.
Ex:
A matched object can be returned by using regular expressions of JavaScript. A matched object has array-like value with matched strings.
Ex: to parse a date in YYYY-MM-DD format.
The last arguments sent to a function are changed to an array using Rest parameters and the (...) notation can be used only for array operations.
Ex:
In an opposite manner, an array is turned into separate arguments using the spread operator. These arguments can be transferred to a function.
Ex:
The method then() is called after successfully resolving the promise and catch() method is declared if a problem occurs. Eventually, the code can be executed using finally() method irrespective of previous occurrences.
ECMAScript is a specification and Javascript is an implementation and is implementing all the versions that are specified by ECMAScript. And it is one reason, why JS is the most popular programming language on the frontend web development. Javascript is everywhere(UI designing/development), backend (server-side coding), mobile applications, game development, etc. It a must for a web developer to update the new versions of ECMA Script and this article is such an attempt.
rohan 2019-06-14 11:16:04 +0530