Answers for "javascript nested array destructuring"

0

javascript nested array destructuring

const person = {
    name: 'Arif',
    age: 22,
    job: 'we-developer',
    friendList: ['abir', 'adnan', 'alvi'],
    companyDetails: {
        id: 3343,
        companyName: 'IT solution',
        salary: 33400,
        location: 'jahanbarge',
    }
}
const [x, y, z] = person.friendList;
console.log(x, y, z);
//Expected output:abir adnan alvi
Posted by: Guest on September-17-2021
65

javascript nested array destructuring

let arr = [1, 2, 3, 4, [100, 200, 300], 5, 6, 7];

// nested array destructuring
const [a, , , , [, b, ,], , , ,] = arr;

console.log(a);
// expected output "1"

console.log(b);
// expected output "200"
Posted by: Guest on December-25-2020

Code answers related to "javascript nested array destructuring"

Code answers related to "Javascript"

Browse Popular Code Answers by Language