JavaScript check number function.

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