Challenge: Destructuring

This challenge will test your skills in implementing object destructuring in JavaScript.

Problem statement #

Study the code on line 2 in the testing widget carefully.

const exampleObject = {collection: [{name: "Kelly",}, {name: "Anna",}],}

Your task is to use destructuring to extract and display the name of the second object in the array.

Input #

An array of objects

Output #

Name of the second object

Sample input #

[{name: "Kelly",}, {name: "Anna",}]

Sample output #

"Anna"

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.