ECMA Script
ECMA Script / ES6 / Modern JS
In 1996 JavaScript was created. In 1997 it was then submitted to ECMA International for standardization, which resulted in ECMAScript.
note
Variables declared with "var" in JavaScript are function scoped. Variables declared with "let and const" are block scoped.
EC6 features
Template Literals or Template Strings (` `)
E.g.
let fName = “Shresth”;
let lName = “Srivastava”;
console.log(`My first name is $(fName). My Last name is ${lName}`)
Template Literals methods:
Array Destructuring:
Swap two number without using third variable:
Object Destructuring:
Arrow Functions / Fat Arrow Functions:
Default Parameter:
Here b=2 and c=2 is given in function parameter is called default parameter.
Rest Parameter (…):
Spread Operator:
Syntax of Spread operator is similar as Rest Parameter but it works differently.
It replaced apply() and concat() and copy() method in javascript.
Exponentiation Operator (**):
Above example will return 25 as output. Same thing we can do with Math.pow(a,b)
async/await: