es6 destructing levels code example
Example: javascript destructing
/*
* On the left-hand side, you decide which values to unpack from the right-hand
* side source variable.
*
* This was introduced in ES6
*/
const x = [1, 2, 3, 4, 5]
const [a, b] = x
console.log(a) // prints out: 1
console.log(b) // prints out: 2