Validating Numbers and Integers

The following functions will check whether a string is a number or an integer respectively.

function isNumeric(s) { return parseFloat(s).toString != 'NaN'; } function isInteger(s) { return parseFloat(s).toString != 'NaN' && parseFloat(s) == parseInt(s); }