Why firebug said it's NaN though it's not?
When I used console.log to view the object that's got problem, it shows :
[Object { productId=1957, amount=3, productIndex=30}, Object { productId=2087, amount=4, productIndex=352}]
But when I drilled into the first object to see its detail :
amount NaN
productId 1957
productIndex 30
which also happens with the second object too
amount NaN
productId 2087
productIndex 352
So I tried to stringify. The result is as follows :
[{"productId":1957,"amount":3,"productIndex":30},{"productId":2087,"amount":4,"productIndex":352}]
Then I tried one last thing to ensure whether the value is not NaN :
console.log(isNaN(obj[0].amount)+','+isNaN(obj[1].amount));
which results :
false,false
Both values are definitely not NaN, but why firebug reports NaN? This also happens with Chrome too.
What could cause this? Did I miss something?
Edited : this question is simpler than those marked as duplicate I think. I did try to search for this kind of this same problem but found nothing. However, when I followed the link to the question, I'm already found an answer to this. Thanks everyone.
Solution to this : console.log is not reliable, alert() is better sometimes.