Javascript – Print an output in one line using console.log()

javascript

Is it possible to print the output in the same line by using console.log() in JavaScript? I know console.log() always returns a new line. For example, have the output of multiple consecutive console.log() calls be:

"0,1,2,3,4,5,"

Best Answer

In Node.js there is a way: process.stdout

So, this may work:

process.stdout.write(`${index},`);

where index is a current data and , is a delimiter.

Also you can check same topic here.