ParseInt returns 1 for when passed any number greater or equal to 1e+21.
var x = 1.0e+2;
console.log( x == 1e+2 );
console.log( parseInt( x, 10 ) == 100 );
console.log( parseFloat( x ) == 100 );
var x = 1.0e+21;
console.log( x == 1e+21 );
console.log( parseInt( x, 10 ) == 1 );
console.log( parseFloat( x ) == 1e+21 );
What do you think the problem is?
I think the problem by be because numbers 1e+21 and greater are represented as strings.
ParseInt might only be looking at valid numbers to parse the number to into an integer. Since e in ‘1e21’ is not a number, 1 is the item returned.
Demo: jsbin.com demo
Update:
V8 Issue Page
What REALLY is Data Science? Told by a Data Scientist - By Joma Tech
Writing perfect code is a challenging process. That's where code reviews come in to help…
"The Next Leap: How A.I. will change the 3D industry - Andrew Price - Blender"
"Captain Disillusion: World's Greatest Blenderer - Live at the Blender Conference 2018 - CaptainDisillusion"
My 5 Favorite Linux Shell Tricks for SPEEEEEED (and efficiency) - By tutoriaLinux > What's…