Last active
April 24, 2018 15:54
-
-
Save gerrard00/b1bc4af9aeab0f98ea72115f237ffb03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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