javascript distructing array code example
Example 1: unpack array into variables javascript
var yourArr = [1, 2, 3]
[one, , three] = yourArray // 2 is ignored
// one == 1 && three == 3
Example 2: javascript function destructuring
function f() {
return [1, 2];
}
let a, b;
[a, b] = f();
console.log(a); // 1
console.log(b); // 2