Skip to content

Instantly share code, notes, and snippets.

@ohaal
Created December 17, 2015 13:10
Show Gist options
  • Save ohaal/e7bbd5346468cc88fdc9 to your computer and use it in GitHub Desktop.
Save ohaal/e7bbd5346468cc88fdc9 to your computer and use it in GitHub Desktop.
Algorithm for looping over a numbers' single digits one by one without using strings
var numberAlone;
while (number !== 0) {
numberAlone = num % 10;
number = Math.floor(number / 10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment