I have an array with some key value data.
var data = [
{
speed : 130,
acceleration: 3.8
},
{
speed : 120,
acceleration: 3
},
{
speed : 90,
acceleration: 1.2
},
{
speed : 140,
acceleration: 1.4
},
]
I would like to get all the 'speed' items into different array. I could use data.map(x => x.speed) but here I do not know the key name.
I want to something like
var extract = getSubArray(data, 'speed');