I have an array of objects, something like this:
var details=[{month: 1, equips:32.1, instals:12.6, softs: 6.7, manuts:6.2, formacs: 9.7, total:0.0}, {mes: 2, equips:37.5, instals:14.1, softs: 7.5, manuts:5.7, formacs: 8.7, total:0.0}];
And to aid me I created a new array "headers" that get the objects headers, something like this function that creates the array I want:
var headers=[]
function getHeaders(){
var i,cab;
for(cab in details[0]) headers.push(cab);
}
And I get an array, something like this headers=[month, equips, instals, softs, manuts, formacs, total]
, and it is working, because if I call, for instance, headers[2] I get "instals".
My may goal was to call something from "details" array with something like this:
details[0].headers[2]
and get the value : 12.6 instead of using details[0].instals
any help?