javascript array destructuring parameters code example
Example 1: destructure array javascript
var [first, second, ...rest] = ["Mercury", "Earth", ...planets, "Saturn"];
Example 2: destructuring Array in JavaScript
let [greeting = "hi",name = "Sarah"] = ["hello"];
console.log(greeting);//"Hello"
console.log(name);//"Sarah"