You are here: irt.org | About | Feedback | 4317 [ previous next ]
Feedback on:
irt.org FAQ Knowledge Base Q39
Sent by
Marcos on December 13, 2002 at 12:57:50:
Worth:
Worth reading
Length:
Just right
Technical:
Just right
Comments:
There is another way using regular expressions, that won't mind leading zeroes. "/\D/" will check for anything that's not a digit (0-9) in the string:
var string = "123a4";
regexp = /\D/;
if (regexp.test(string))
alert(string + " is not a natural number.");