Forum Moderators: open
How many inches are in 4 feet?
I need to go word by word and check which one is the number. I know in C/C++ I could check the return value of atoi to see if its -1, but I can't find an equivelent.
I've tried checking the results of Number("asdf") for example, which returns NaN in an alert, but even
alert(Number("a") == Number("a"))
returns false. Any ideas?
var sentence = "How many inches are in 4 feet?";
var sentenceArray = sentence.split("");
var req = /\d/;
for(i = 0; i < sentenceArray.length; i++)
{
var test_sentence = req.test(sentenceArray[i]);
}