To unpack array into separate variables in JavaScript, we use destructuring.
For instance, we write
const arr = ["one", "two"];
const [one, two] = arr;
to assign the entries in arr
into their own variables with the destructuring syntax.
So one
is 'one'
and two
is 'two'
.