Created
November 13, 2019 07:43
-
-
Save hoyangtsai/07d3a41f7ee6324e55b4be9b2a9eb600 to your computer and use it in GitHub Desktop.
check a char is number between 0 and 9
This file contains hidden or 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
let charCode = String.prototype.charCodeAt.call(str, index) | |
// char code between 48 and 57 is the number 0 - 9 | |
if ( charCode < 48 || charCode > 57) { | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment