0

How can i separate two variables when show on screen?

I did the code var x = 100; document.write(x); var d = 50; document.write(d); And it shows 10050 but i would like for it to show like this. 100 50 How can i do this?

19th Mar 2021, 5:47 PM
Daniela Silva
Daniela Silva - avatar
3 Antworten
+ 5
You can add the following line to break the text using HTML tag: document.write("<br/>"); So the result will be this: var x = 100; document.write(x); document.write("<br/>"); var d = 50; document.write(d); And it shows: 100 50 You also can do something like this: var x = 100; var d = 50; document.write(x + "<br/>" + d);
19th Mar 2021, 5:53 PM
Simone Vitto
Simone Vitto - avatar
0
I usually do document.write(x+", "+d)
19th Mar 2021, 6:21 PM
Pablo Sosa
Pablo Sosa - avatar
- 1
document.write(x + "<br/>" +d);
19th Mar 2021, 8:19 PM
Matheus Zotti
Matheus Zotti - avatar