Last Updated: February 25, 2016
·
522
· dieseltravis

Testing for numeric values in javascript

var isNumber = function (n) {
  return !isNaN(parseFloat(n)) && isFinite(n);
};

Pass in strings, or any other object in javascript.

Check out all these passing unit tests!

Source: This Stack Overflow answer