I've been using this trick a few time now but I still can't wrap my head around why this works and can't seem to find the answer. Could anybody please explain ?
let myArray = [0, 1]
let [myVar] = myArray
console.log(myVar) // outputs 0
How is [myVar] the same thing as putting [0] behind myrArray ?
Edit: already asked and answered here : Multiple assignment in javascript? What does [a,b,c] = [1, 2, 3]; mean?
Thank you everyone