check if string is interpretable as int

Mattijs's icon

Hi,

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.

Cheers,
Mattijs

Mattijs's icon

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 :)

Thanks,
Mattijs