if console.log is just process.stdout.write with a line-break at the end, then Why do I get nothing printed when I use process.stdout.write but I get answer in console.log() for the following code.
var waittime = 3000;
var currenttime = 0;
var waitint = 10;
function percentage(p) {
process.stdout.clearLine();
process.stdout.cursorTo(0);
process.stdout.write(`waiting ... ${p}%`);
}
var interval = setInterval(function() {
currenttime += waitint;
percent = Math.floor((currenttime / waittime) * 100);
percentage(percent);
}, waitint);
setTimeout(function() {
clearInterval(interval);
percentage(100);
process.stdout.write("\nGowtham");
}, waittime);
process.stdout.write("\nIt's not getting displayed");
//console.log("It's getting displayed here!");
What's wrong? There is a difference I guess. Correct me if I'm wrong.