Skip to content

Instantly share code, notes, and snippets.

@everdimension
Created September 8, 2017 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save everdimension/07a69c129454f6c5df4301ef1b02ce27 to your computer and use it in GitHub Desktop.
Save everdimension/07a69c129454f6c5df4301ef1b02ce27 to your computer and use it in GitHub Desktop.
Robust way to check if a value (number or string, usually from user input) can be considered a number.
function isNumericValue(n) {
return !isNaN(Number(n) - parseFloat(n));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment