Why is the output 1? Can someone explain me step by step about what is happening in the second line here?
Advertisements const a=[1,2,3,4,5]; const [n]=a; console.log(n); I need to know how does something inside square brackets after const means, and why it stored only 1 and not the entire array. >Solution : It is ES6 Destructuring Assignment. const a = [1,2,3,4,5]; const [n] = a; const [m, o] = a; const [p, q, r] =… Read More Why is the output 1? Can someone explain me step by step about what is happening in the second line here?