Say I have an array of objects:
[
{
'prop1': 'hello world',
'prop2': false
},
{
'prop1': 'asdf asdf',
'prop2': true
},
{
'prop1': 'bob ross',
'prop2': false
}
]
And now I want to create a new array that just lists one of the properties, for example:
createArrayFromProperties(array, item.prop1);
↓ Output ↓
['hello world', 'asdf asdf', 'bob ross']
Is this possible to do with a built in JS method, or do I have to use a loop?