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

javascript

Solution

Couldn't you just put them in the same call, or use a loop?

  var one = "1"
  var two = "2"
  var three = "3"

  var combinedString = one + ", " + two + ", " + three

  console.log(combinedString) // "1, 2, 3"
  console.log(one + ", " + two + ", " + three) // "1, 2, 3"

  var array = ["1", "2", "3"];
  var string = "";
  array.forEach(function(element){
      string += element;
  });
  console.log(string); //123

Problem

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," ```

Original source

Related problems