I have the following array, I want to loop through it and push the key values to another declared array. Then, loop through the array and push field and values of a key to another array.
timeframe = [];
timeframeValueKeyUSD = [];
timeframeValueKeyCAD = [];
array = [
{
"2012-05-01":{
"USD": 1.322891,
"AUD": 1.278047,
"CAD": 1.302303
},
"2012-05-02": {
"USD": 1.315066,
"AUD": 1.274202,
"CAD": 1.299083
},
"2012-05-03": {
"USD": 1.314491,
"AUD": 1.280135,
"CAD": 1.296868
}
}
]
I want to get the arrays as this:
timeframe = ['2012-05-01', '2012-05-02', '2012-05-03'];
timeframeValueKeyUSD = [1.315066, 1.315066, 1.314491];
timeframeValueKeyCAD = [1.302303, 1.299083, 1.296868];