Clean and simple:
The trick is using \r at the end
\r
const arr = [0, 1, 2, 3] for(let i = 0; i < arr.length; i++) { process.stdout.write(`Index: ${i}\r`); }