- [Narrator] So let's for the fun of it
add one more thing.
We're going to add this to our increment time function.
So right underneath where we're saying current time
and wait interval, we're going to create a value called p,
and we're going to set that equal to Math.floor.
Inside of this we're going to take
our currentTime divided by our waitTime.
We're going to multiply that by 100.
And then we're going to say process.standard output.clearLine.
We're going to say process, standard, output.cursorTo
and we'll set the cursor to zero.
So that first position will get rid
of our other console message.
And here we'll say process, standard output.right, waiting.
And then we'll use that p value that we've set here.
Let's go ahead and run it one more time.
So now we see the waiting communicated
as a percentage in place,
and that's because standard output gives us the tools
to manage how we write all of this data to the console.
So we're using these tools to overwrite the last line
and rewrite the percentage, which is pretty cool.
So I wonder what else we could use this logic for.
While we could communicate how far along
with any asynchronous process using logic like this.
So lots of cool powerful tools built directly into Node.js
inside of these standard input and standard output objects.