Skip to content
Advertisement

How to overwrite previous text in center of screen

I want to print to the center of the terminal and am using:

JavaScript

Later on I want to overwrite the text with:

JavaScript

That is the new text should completely replace the old text.

How can you do that?

Advertisement

Answer

You can use print with end and flush parameters

JavaScript

Here is a quick example

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement