How to console.log without newline in JavaScript

Tari Ibaba
Coding Beauty
Published in
4 min readJul 20, 2024

--

There’s a little-known way to console log without newline that many developers have never used.

Let’s say we need to log in a loop like this:

Does normal console.log work?

Nope:

So what do we do?

What we do: is process.stdout.write:

process.stdout.write prints to the console without any newlines whatsoever:

How is process.stdout.write different from console.log?

Well first of all, console.log IS process.stdout.write!

--

--