1 2 function isNumeric(value) { 3 if (value == null || !value.toString().match(/^[-]?\d*\.?\d*$/)) return false; 4 return true; 5 }
This logic is straight-forward: if the parameter isn't null, convert it to a string and match it against a RegEx to throw out false cases. Otherwise, return true.