I'm wondering if I can destructure this array of objects
const course = {
id: 1,
name: 'Half Stack application development',
parts: [
{
name: 'Fundamentals of React',
exercises: 10,
id: 1
},
{
name: 'Using props to pass data',
exercises: 7,
id: 2
},
{
name: 'State of a component',
exercises: 14,
id: 3
},
]
}
and save the property exercises
in a variable, I dont know if we would ever do this, just want to know how and if we can destructure object properties in an array of objects
@ggrlen
Here's the array
const arr = [{
name: 'State of a component',
exercises: 14,
id: 3
}];
I want to destruct the object in this array, to extract value of exercises
property into a variable, thanks for the reply btw.