Here's my code:
var data = $.parseJSON('[{"Date":"2014-02-19","Count":"963"},{"Date":"2014-02-20","Count":"2638"}]');
console.log(data);
console.log(typeof data[0].Count);
data.forEach(function(d) {
d.Count = +d.Count;
});
console.log(typeof data[0].Count);
The first console log treats my Counts as numbers inside of each object.
The second console log is string.
The final console.log is number.
Can someone explain to me why the first console log treats each Count as a number, when I'm logging the data object prior to Count being manipulated into a number with the d.Count = +d.Count line of code?
Here's a fiddle with the code in it: http://jsfiddle.net/b73fZ/