I don't understand why the code below returns seemingly incorrect values (150 instead of 100):
var price = {
33427009000001024: 100,
33427009000001025: 150,
33427010000001026: 200
};
alert(price[33427009000001024] + "," + price["33427009000001024"]);
Run codeDisplayed Values: 150,150
I fixed it by including the properties of the object in quotation marks:
var price = {
"33427009000001024": 100,
"33427009000001025": 150,
"33427010000001026": 200
};
But I don’t understand if quotes are really needed / needed and why am I not getting an error, but just the wrong values?
source
share