I have an array of objects:
[{
name: "test",
age: 20,
gender: "male"
},
{
name: "test2",
age: 22,
gender: "female"
}]
Frequently I need to create a singleton array which contains a specific property from the object array above, for example extract only the names from the array above and create an array from it:
NewArray = ["test","test2"]
Currently I loop over the object array and push the property I need to the new array.
Is there a quick way to do it in Javascript/ES instead of looping every time I need to get specific property?