Reputation: 451
How do you log something to the console without going to a new line in JavaScript?
Upvotes: 0
Views: 619
Reputation: 370729
Every console.log
call will result in the argument being logged on a new line. I think your only option is to batch everything you want to be on a single line together (either in a single string or in separate arguments), then call console.log
just once with that line, eg:
const arr = ['a', 'b', 'c'];
let lineToLog = '';
for (const char of arr) {
lineToLog += char;
}
console.log(lineToLog);
Upvotes: 1