Skip to content

Instantly share code, notes, and snippets.

@alfredwesterveld
Last active August 19, 2016 08:13
Show Gist options
  • Select an option

  • Save alfredwesterveld/3bba1bad32b35ba21d12db37bf90b457 to your computer and use it in GitHub Desktop.

Select an option

Save alfredwesterveld/3bba1bad32b35ba21d12db37bf90b457 to your computer and use it in GitHub Desktop.
Keep printing to same line from [0, 100]. When done print done on same line and exit program.
const log = require('single-line-log').stdout
let i = 0
const id = setInterval(() => {
log(i++)
if (i === 100) {
clearInterval(id)
log.clear()
log('done\n')
}
}, 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment