Javascript parseInt on large negative number gives NaN -


when this:

var x = parseint("–2147483648"); console.log(x); 

i value as:

nan 

why happen?

i want test if number in range of c (int), doing above, not work. also, want c (long), there way this?

for example: if do:

var x = parseint("-9223372036854775808"); console.log(x); 

now, know (-+)2^53 limit of numbers in javascript. there other way test if given value in form in range of long or int?

it should work fine, problem you're using wrong character, ndash vs hyphen -:

var x = parseint("-2147483648"); console.log(x); 

if copy/paste you'll see works now.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -