Array Destructuring
JS · Variables & Constantssyntax
const [a, b, ...rest] = array;example
const rgb = [30, 120, 255];
const [red, green, blue] = rgb;
console.log(green);
const [first, , third] = ["a", "b", "c"];
console.log(first, third);output
120
"a" "c"Note Use commas to skip elements. Works with any iterable, not just arrays.