filter objects in array

PHOTO EMBED

Wed Apr 05 2023 22:14:21 GMT+0000 (Coordinated Universal Time)

Saved by @azcraze #javascript #array #filter #object

const friends = [
  { name: "Abby", age: 22 },
  { name: "Boby", age: 16 },
  { name: "Coel", age: 20 },
  { name: "Dany", age: 15 }
];

//who can drink?
friends.filter(friend => friend.age >= 18);
content_copyCOPY

https://codetogo.io/how-to-filter-objects-in-array-in-javascript/