Destructuring Arrays in Javascript


Extract values from arrays.

Source Code

let colors = ['red', 'green', 'blue'];
let [firstColor, secondColor] = colors;
console.log(firstColor); // "red"
console.log(secondColor); // "green"
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments