I have an array of objects like this:
var myArray = [{
key: 2,
value: 10,
},
{
key: 5,
value: 4,
},
{
key: 3,
value: 8,
},
{
key: 12,
value: 4,
}];
How is the most elegant way to convert this array in other just with the key numbers: [2,5,3,12]
?