Summing numbers in the -10,000,000 range

I am summing numbers in the -10,000,000 range (the data does not have commas).

I am getting “NaN” for a result.

Is there any way of displaying the result and make calculations with the sum?

Answer me this. What are the reasons for a “NaN” result?

There sure is - what code are you currently using?

NaN means Not A Number, which can result from trying to add together non-numbers, such as undefined + 10;


var total; // undefined
total += 10; // total is now NaN

It’s best to assign a default value, in such cases.


var total = 0; // default value of 0
total += 10; // total is now 10