1.

Explain Destructuring in ES6.

Answer»

Destructuring was INTRODUCED in ES6 as a way to extract DATA from arrays and objects into a SINGLE variable. It is possible to extract smaller fragments from objects and arrays using this method. The following is an example.

let greeting =['GOOD','Morning']; let [g1, G2] = greeting; console.log (g1, g2);

Output:

Good Morning


Discussion

No Comment Found