ES6 Lesson #12 - Destructive array assignment
Now in ES6 there is the ability to quickly assign variable values to arrays.
It's simple. If you have an array, and you need to assign its values to variables. Instead of variables, immediately indicate an array of variables
let array = [1,2,3]
let [ar1, ar2, ar3] = array
console.log(ar1, ar2, ar3) // return 1 2 3
let [dr1, ,dr3] = [1,2,3]
console.log(dr1, dr3) // return 1 3
let [dz1, ...dzall] = [1,2,3,4,5]
console.log(dz1, dzall) // return 1 [2, 3, 4, 5]
let [dl1, dl2 = 5, dl3] = []
console.log(dl1, dl2, dl3) // return undefined 5 undefined