Input value always gets into if condition first even am parsing it to parseInt() and when page refreshed with a number it gets into else condition, like its not registering the inputValue at first …
Tag: parseint
parseFloat() from the middle of the string
I always have a “NaN” when wanted to “parseInt or parseFloat” from string like “Sometext 330” and it will return “NaN” but i need integer or float 330 Answer You could sanitize your string first so only digit’s remain in the string before parsing the number. edit: now it’s even safer as it will accept Number types without blowing up.