javascript find is destructuring code example
Example 1: object destructuring example
const hero = {
name: 'Batman',
realName: 'Bruce Wayne',
address: {
city: 'Gotham'
}
};
const { realName, address: { city } } = hero;
city;
Example 2: array destructuring in javascript
const array = ['ismail', 'sulman'];
const [firstElement, secondElement] = array;
console.log(firstElement, secondElement);
const secondArray = ['ismail', 'naeem', 'Mr', 1];
const [firstEl, secondEl, ...array1] = secondArray;
console.log(firstEl, secondEl, array1);