I have this javascript object..
var obj = {
'02/08/2016': 2,
'03/10/2016': 4,
'04/05/2016': 2,
'04/06/2016': 35,
'04/19/2016': 4,
'04/26/2016': 22,
'05/09/2016': 15,
'05/24/2016': 2,
'05/30/2016': 4,
'07/14/2016': 7,
'08/18/2016': 200
};
// Does not work
$(obj).each(function(index,value) {
console.log(index);
console.log(value);
});
// Does not work, also what does putting it in bracket notation do here?
var labels = $.map(obj, function(index, value) {
return [index];
});
Why can I not iterate the object? I am trying to place this data in two separate arrays (like below) for chart.js
var arr1 = ['02/08/2016', '03/10/2016', '04/05/2016', ..];
var arr2 = [2, 4, 2, ...];
Code Fiddle: https://jsfiddle.net/zjgb6ez4/