+ 1
How to combine into one line
the console.log() in JS outputs each item from a new line, how to combine into one line?
11 Respostas
+ 1
console.log(1, 2, 3);
// output in a single line
+ 1
for example, output in an array loop
+ 1
x = [1, 2];
console.log(...x);
+ 1
Form a list or string inside loop. And Output out side loop. I think, you cannot inside loop with console.log() in a single line.
+ 1
console.log('#x27; + msg.join('#x27;) + '#x27;);
I managed to display the result, maybe someone will need it
+ 1
If you simply unpack the array, you don't need to construct a string
https://code.sololearn.com/cCI7zHjM3xR3/?ref=app
0
If this is about code coach task then you need that way to use join or form string in loop. Display at end.
0
I think you can use the follow:
const arr = [10 , 20 ,30 , "str"];
console.log(JSON.stringify(arr));
0
console.log() accepts multiple inputs(items) which should be separated by comma.
e.g:
let firstName='Anna';
let lastName='Priadkina';
console.log(firstName, lastName);
0
thanks for the reply, but it's not exactly what you need
0
put all the lines into a variable, then callback the variable using console example
var x = "gyuyuyuyuehyuhyuhughayuawghyuuawyugiuawhiuyughukgyuahugfyefkhjgeyakughlEURAAYRyuyuergyuyuayu";
console.log(x);
or better still, use different variables and dom to and line breaks to the html or use assignment operator to add string variables