const people = [ { name: 'Alice', age: 25 }, { name: 'Bob', age: 30 }, { name: 'Charlie', age: 22 }, { name: 'David', age: 28 } ]; console.log(people[0].name) function findPeopleOnage(people){ let newarr = [] for(let i=0; i<people.length; i++){ if(people[i].age>=25){ newarr.push(people[i].name) } } return newarr } console.log(findPeopleOnage(people))
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter