I am building some UI page using jQuery. In some function, i am creating a JavaScript object as
var key = "04:52:00";
var val = 13.21;
var data = {
key : val
};
When I try to loop through the data object like,
for(var category in data) {
alert(category);
var points = data[category];
alert(points);
}
In the above, I am getting the value of val variable correctly as 13.21, but I am not getting key variable value, instead in the alert(category);, I am getting key not 04:52:00.
I am not much familiar with jQuery/JavaScript.