// array of nested objects
const persons = [
{ name: { first: 'jake', last: 'make' }, age: 21 },
{ name: { first: 'jake', last: 'cake' }, age: 22 },
{ name: { first: 'jake', last: 'take' }, age: 23 },
]
// beginner method
const make = persons.filter((person) => person.name.last === 'make')
// intermediate method
const cake = persons.filter(({ name }) => name.last === 'cake')
// advanced method
const take = persons.filter(({ name: { last } }) => last === 'take')
console.log('make =', make)
console.log('cake =', cake)
console.log('take =', take)
To embed this project on your website, copy the following code and paste it into your website's HTML: