1.

Explain Destructuring Assignment In Es6?

Answer»

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]

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]



Discussion

No Comment Found