Created
September 8, 2017 17:44
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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