‘console.clear()’
method clears the messages on terminal.
HelloWorld.js
console.log("Hello World"); console.log("Going to sleep for 2 seconds"); /* Wait for 2 seconds */ var seconds = 2; var waitTill = new Date(new Date().getTime() + seconds * 1000); while(waitTill > new Date()){} console.clear(); console.log("Cleared old messages");
Note
When
stdout is not a TTY, this method does nothing.
No comments:
Post a Comment