This question is from the JavaScript Documentation -
var elements = [
'Helium',
'Oxygen',
'Lithium',
'Beryllium'
];
console.log(elements.map(({ length }) => length));
// Output - [6, 6, 7, 9]
I am not able to understand How is it able to calculate length of each elements from the array? I mean how this syntax works?
Destructuring assignmentofes2015