I'm newbie to JavaScript, I have a JavaScript object
[{G4S: "31"},{G4S: "23"},{G4S: "31"},{G4S: "49"},{G4S: "110"},{G4S: "115"},{G4S: "104"}]
I want to create an array like
[31, 23, 31, 49, 110, 115, 104]
I referred some links, but they are showing how to create object from array, not array from object. How to get the key value in JSON object?
Creating javascript object from array values
Creating a JavaScript Object from two arrays
I tried like this:
for (var i = 0; i < chartDataG4S.length; i++) {
var data = chartDataG4S[i]['G4S'];
console.log(data);
}
But it wont create an array. I'm stuck with this, any kind of help is welcome, thanks in advance.