ARRAY
Array filter
const people = [
{ name: 'Jon', age: 23 },
{ name: 'Daenerys', age: 23 },
{ name: 'Arya', age: 17 }
]
const children = people.filter(person => person.age < 18)
// Returns [ { name: 'Arya', age: 17} ]
Array filter
const people = [
{ name: 'Jon', age: 23 },
{ name: 'Daenerys', age: 23 },
{ name: 'Arya', age: 17 }
]
const adult = people.find(person => person.age >= 18)
// Returns { name: 'Jon', age: 23 }
Array forEach
const people = [
{ name: 'Jon', age: 23 },
{ name: 'Daenerys', age: 23 },
{ name: 'Arya', age: 17 }
]
people.forEach(person => sendNotification(person))
Top comments (0)