use array of values for destructing object code example
Example 1: object destructuring default value
let a, b;
[a=5, b=7] = [1];
console.log(a); // 1
console.log(b); // 7
Example 2: array destructuring in javascript
const array = ['ismail', 'sulman'];
// array destructuring
const [firstElement, secondElement] = array;
console.log(firstElement, secondElement);
const secondArray = ['ismail', 'naeem', 'Mr', 1];
const [firstEl, secondEl, ...array1] = secondArray;
console.log(firstEl, secondEl, array1);