Skip to content

Instantly share code, notes, and snippets.

@fiftin
Created December 27, 2016 03:17
Show Gist options
  • Save fiftin/00b8ab7182ae8190e64b742a56a57063 to your computer and use it in GitHub Desktop.
Save fiftin/00b8ab7182ae8190e64b742a56a57063 to your computer and use it in GitHub Desktop.
Number of digits
function numDigits(x) {
return (Math.log10((x ^ (x >> 31)) - (x >> 31)) | 0) + 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment