Skip to content

Instantly share code, notes, and snippets.

@halfzebra
Created June 15, 2018 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halfzebra/16f531ef196dc38a16100ecf4e9c931c to your computer and use it in GitHub Desktop.
Save halfzebra/16f531ef196dc38a16100ecf4e9c931c to your computer and use it in GitHub Desktop.
function powerOf10LessThan(number) {
return Math.floor(Math.log10(number))
}
function step(number) {
return value + (10 ** powerOf10LessThan(number))
}
function stepMany(number, steps) {
let res = value
for(let i = 0; i < steps; i++) {
res = step(res)
}
return res
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment