I have parsing values to integer in my function using parseInt, but when i parse the -4.450217635509901e-7 to integer it returns -4.
parseInt(-4.450217635509901e-7)=> -4
-4.450217635509901e-7 is nothing but -0.000000450217635509901 so it should return 0 but for me its returning -4.
How to parse the values having exponential?
Math.floororMath.ceilorMath.round? It doesn't seem likeparseIntis what you need here, as you already have a number.parseIntis called. All it gets is a number value.parseIntis intended to be used with strings. Please explain what you are trying to achieve. What happens in your case is that the number is converted to a string, and it will be formatted using scientific notation (basically the same notation you used for the number literal).parseIntiterates over every character, collecting those it understands (leading +/- and digits)..is neither so it stops and converts the collected chars to a number.