Categories
JavaScript Answers

How to erase characters printed in console with Node.js?

Spread the love

Sometimes, we want to erase characters printed in console with Node.js.

In this article, we’ll look at how to erase characters printed in console with Node.js.

How to erase characters printed in console with Node.js?

To erase characters printed in console with Node.js, we can use the process.stdout.write method with a carriage return.

For instance, we write

process.stdout.write("\r");

to to move the cursor pack to the start of the line.

Then we can call process.stdout.write again to write something else to the same line.

Conclusion

To erase characters printed in console with Node.js, we can use the process.stdout.write method with a carriage return.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *