Forums > Javascript

check if string is interpretable as int

Nov 21 2006 | 10:16 pm


This might be a very basic question: is there a way in javascript to determine whether a string is interpretable as an int?

In java there is Integer.parseInt(String). Is there something similar in javascript? I didn’t find it in docs so far.


Nov 21 2006 | 10:30 pm

Ok, sorry. Found it. I was confused because parseInt gave a strange output when posted, "1#R" if not cast to string. And I found the isNaN method :)


Viewing 2 posts - 1 through 2 (of 2 total)

Forums > Javascript