I am using jQuery to pull some data from a web page, it comes back as an array with the following values (.5, .25, 1.25, 3.75) which I am trying to add. Here's my code snippet:
var th = 0;
for (thisrow in objGrid) {
var hours = objGrid[thisrow]['hours'];
th = th+parseFloat(hours);
console.log(hours);
$("#msgbox").html("Showing records for week: " + thisDate + ". Total Hours for the week : " + th);
}
in console.log I am getting this for the hours - 0, 0 , 1, 3 and it is totaling 4. If I don't use parseFloat I still get the same results, (thought I would get NaN). What am I doing wrong?