'what is the equivalent of Java's System.out.print() in javascript [duplicate]

It seems console.log() is the equivalent of System.out.println()

How to print strings in the same line with multiple calls?

Like:

for (let i=0;i<2;i++){
  console.log(i);
}

but print in the same line.



Solution 1:[1]

console.log is not the equivalent, it does other things toolike formatting objects.

You're looking for process.stdout:

  • process.stdout.write

and

  • process.stdout.writeln

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1