JavaScript parseInt() does not seem to work the same way as Java parseInt().
A very simple example is:
document.write(parseInt(" 60 ") + "<br>"); //returns 60
document.write(parseInt("40 years") + "<br>"); //returns 40
document.write(parseInt("He was 40") + "<br>"); //returns NaN
Line 1 is ok. but I expect line 2 to give an error, since you can't actually convert 'years' to an integer. I believe JavaScript parseInt() just checks if the first few characters in a String are an Integer.
So how can I check that as long as there are non-Integers in the String, it will return NaN?