JSFiddle - React, Tailwind, and code Playground

by jrab227

JavaScript

function isAnyNumber(n) {
  const num = parseFloat(n);
  return !(String(n).search(/\S/) === -1) && !isNaN(num);
}

alert(isAnyNumber(2))