Skip to content

Instantly share code, notes, and snippets.

@Alex1990
Last active August 29, 2015 14:05
Show Gist options
  • Save Alex1990/af34154bf90e904ff949 to your computer and use it in GitHub Desktop.
Save Alex1990/af34154bf90e904ff949 to your computer and use it in GitHub Desktop.
Check if a string consists of the digit characters (0-9)
// Check if a string consists of the digit characters (0-9)
function isDigit(str) {
return str && !/[^\d]/.test(str);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment