ECMAScript 6, otherwise called ECMAScript 2015, is the most recent form of the ECMAScript standard. ES6 is an important upgrade to the language, and the first update to language since the release of ES5.1 in June 2011
A few of the new features of ES6 are:
Arrow functions
Classes
Enhanced object literals
Destructuring assignment
Extended parameter handling
Generator
Modules
Proxy
We will look at all these functions in the upcoming sections.
Arrow functions are also known as fat arrow functions. It is a function and is similar to what we use in C#, Java, and Coffee Script. Statements and expression bodies are supported by arrows. The lexical of arrows is similar to its surrounding code. This is not the case in functions.
As the name suggests, arrow functions use a shorter syntax, an arrow (=>
), for definition and in syntax.
For example, look at the following example:
// An empty arrow function returns undefined let empty =()=>{}; (()=>"pine")()// returns "pine...