My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Create Array from Array of Objects

Maneesh Kumar's photo
Maneesh Kumar
·Aug 9, 2019

Looking for optimized solution for below program.

ArrayOfObj = [ {name: "XYZ" , age:30}, {name: "ABC" , age:30},{name: "ABC" , age:17},{name: "ABCD" , age:41},{name: "XYZ" , age:30}....... n objects ]

Now , I want to get the name(only) in array from all the objects whose age = 30 . output = ["XYZ", "ABC","XYZ" ........]