...

/

Solution Review: Destructuring

Solution Review: Destructuring

This lesson will explain the solution to the problem in the previous lesson.

Solution #

Press + to interact
function display(){
const exampleObject = {collection: [{name: "Kelly",}, {name: "Anna",}],}
const { collection: [,{name: secondObject,}] } = exampleObject
console.log(secondObject)
}
display()

Explanation #

This problem has a one-line solution. Let’s start by discussing what exampleObject contains:

const exampleObject = {
   collection : [
         
...
Access this course and 1400+ top-rated courses and projects.