Is it possible to break JavaScript Code into several lines? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Is it possible to break JavaScript Code into several lines?

In output page without using html is it any way to achieve this..

6th Nov 2020, 10:39 AM
WarLord
WarLord - avatar
14 Answers
+ 3
If you want to write in the dom then: document.write("Helllo <br/> Next line <br/> 3rd line"); Br tag brakes line
6th Nov 2020, 11:37 AM
Steve Sajeev
Steve Sajeev - avatar
+ 3
What use in console.?
6th Nov 2020, 11:38 AM
WarLord
WarLord - avatar
+ 3
You can use it document.write("Helllo <br/> World<br/> "); Console.log() is mostly used debugging tool as i have seen on Google
8th Nov 2020, 6:20 AM
Jiya
Jiya - avatar
+ 2
I want to break the line using only java script code..
6th Nov 2020, 11:34 AM
WarLord
WarLord - avatar
+ 2
there is anyway to achive nextline in both console and browser
6th Nov 2020, 11:43 AM
WarLord
WarLord - avatar
+ 1
I am willing to help you but for some reason I couldnt understand what result you want. It would be appreciated if you clarified the question.
6th Nov 2020, 11:31 AM
Steve Sajeev
Steve Sajeev - avatar
+ 1
Yes, for dom use <br/> and for console is \n
6th Nov 2020, 5:54 PM
Steve Sajeev
Steve Sajeev - avatar
0
A new line can be made using \n
6th Nov 2020, 11:35 AM
Musicdudejoe
0
To use in console you have to do: console.log("helo \n second line \n 3rd line");
6th Nov 2020, 11:41 AM
Steve Sajeev
Steve Sajeev - avatar
0
Are you using a script for your JavaScript?
6th Nov 2020, 11:44 AM
Musicdudejoe
0
Console.log (1, 2, 3, 4)
7th Nov 2020, 1:43 AM
David Ordás
David Ordás - avatar
0
The best way is using ES6 template literals with `` backtipped string document.write (` Line1 Line2 Line3 .... ${varname} `); on "console.log" too You can also use variables inside ${varname} https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
7th Nov 2020, 1:46 AM
David Ordás
David Ordás - avatar
0
Yes you can
8th Nov 2020, 7:13 AM
CYRILL JOY QUESECO
CYRILL JOY QUESECO - avatar
- 1
Hi
8th Nov 2020, 10:36 AM
Md Abdullah
Md Abdullah - avatar