It is not possible, not least because this was created to help the debug of your application, so no special formatting is required. This function does not print on screen.
If you still want to do something in this sense the proper way is to create the string all before and issue the print only after everything ready, then you do not put the break in each concatenation that you want. You can even create a sophisticated function that does this.
I’d set a better example if the question had the code that needs this, but it would be something like this:
console.log("Exemplo de texto " + variavel + " continua o texto " + "já isso não faz sentido porque a concatenação pode ser eliminada, mas isso pode ser útil: " + var1.toString() + var2.toString());
In a loop:
var texto = "";
for (var i = 0; i < var.length; i++) texto += var[i] + " ";
console.log(texto);
I put in the Github for future reference.
Solutions that do not use the console.log()
will print on screen, so it does not solve your reported problem.
It seems to me what you want to do is
console.log(array.join(" "))
?– Isac
What is it ? explains me
– Victor OCV
join
creates astring
with all elements in it separated by separator you indicate, in case I used the space. All the answers you received have useful information that you should absorb, but it seemed to me that’s what you were trying to do, given the context.– Isac
Man, thanks is exactly what I wanted.
– Victor OCV
Give it as an Isac response.
– Victor OCV
But this does not answer what you are asking hehe. The question that is asked is another, which is if you give
console.log
without breaking the line.– Isac
kkk ok then :/
– Victor OCV
@Isac But you can post yes if you tweak the answer text. Tell him that the way he asked you to do it, but that by doing it the way you suggested, you should attend to his needs. Sometimes we have to answer not exactly what the author of the question actually asked but rather what solves the problem for him.
– Victor Stafusa
@Victorocv you tell how to accept?
– Maniero
I’ve learned already. v
– Victor OCV