if use big number in "alert" or "console.log" return bad result. Example:
alert(999999999999999999);
Result:
1000000000000000000
But we dont have any problem on alert(999999999999999);
or alert(99999999999999999999999999999);
if use big number in "alert" or "console.log" return bad result. Example:
alert(999999999999999999);
Result:
1000000000000000000
But we dont have any problem on alert(999999999999999);
or alert(99999999999999999999999999999);
As the maximum integer in js is 253 or 9007199254740992
(see the link Jonathan Lonowski mentioned: What is JavaScript's Max Int? ) every number that exceeds this limit is not an integer anymore but a float.
As you can only represent certain numbers using floats. The result of an input value that is larger then an integer would - most of the time - be an aproximated one. That's why you get those results when you alert
or console.log
.