Skip to content

Instantly share code, notes, and snippets.

@gerrard00
Last active April 24, 2018 15:54
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 gerrard00/b1bc4af9aeab0f98ea72115f237ffb03 to your computer and use it in GitHub Desktop.
Save gerrard00/b1bc4af9aeab0f98ea72115f237ffb03 to your computer and use it in GitHub Desktop.
// const limit = 1000000;
// const limit = Number.MAX_SAFE_INTEGER;
const limit = 1000000000;
let lastBarLength = 0;
let lastBar = '';
console.log('start');
for(let i = 0; i < limit; i++) {
const percent = Math.floor(i * 100/limit);
if (percent > lastBarLength) {
lastBarLength = percent;
// console.log(percent);
lastBar = lastBar + '\u2588';
// lastBar = lastBar + '*';
process.stdout.write(lastBar + '\r');
// console.log('bang');
// console.log(percent + lastBar);
}
}
console.log('\ndone');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment