Wednesday, July 29, 2009

Javascript isNumeric()

After flopping around looking for a Javascript isNumeric() function, Rosetta Code came to the rescue with isFinite(num):

 string value = "123.45e7";  
if (isFinite(value))
{
// do something
}
//Or, in web browser in URL box:
// javascript:value="123.45e4"; if(isFinite(value)) {alert('numeric')} else {alert('non-numeric')}

No comments: