Did you know that array destructuring can extract multiple properties in one statement, can access properties from nested array, and can set a default value if the property doesn’t exist yet in your array.
Let's take a look
var arr = ["Hello", "World"] // destructuring assignment var [first, second] = arr; console.log(first); // Hello console.log(second); // World
In this above example, Here
var [first, second] = arr is an object destructuring assignment. If we want to destructure the array into multiple properties, enumerate as many properties as you like adding commas
const [ identifier1, identifier2, ..., identifierN ] = expression;
Nested Array Destructuring:
const numbers = [1,2,3,[11,22,33]]; const [one,two,three,[eleven, twelve, thirteen ]] = numbers console.log(one) //1 console.log(eleven) //11
Skipping Items From Array Destructuring:
We can skip items by using the comma. One comma skips one item.
const numbers = [1,2,3]; const [,,three] = numbers; console.log(three); //3
Hope it can help you.