Posted On: Feb 22, 2018
Destructing assignment in another improvement in Es6. It allows us to extract data from array and objects into separate variables.
Example
let full_name =['John','Deo']; let [first_name,last_name]=full_name; console.log(first_name,last_name); // outputs John Deo
Another example
let c=[100,200,330,400]; let [a,...b]=c; console.log(a,b); // outputs 100 [200, 330, 400]
Never Miss an Articles from us.
Es6 or ECMASCRIPT 2015 is sixth major release of ECMAScript language which comes with a lot of new features and syntax..
New Features in ES6. Support for constants (also known as “immutable variables”) Block-Scope support for both varia..
Babel is one of the most popular JavaScript transpilers and becomes the industry standard. It allows us to write ES6 cod..