KarmaKid
KarmaKid

Reputation: 25

Linebreak in javascript

var y=21.5;
document.write(y);

var num = 10; 
document.write(num == 8);

Hi guys, it's my first time here to ask question in this forum. I am currently studying the basics of javascript and i want to know how can i put a linebreak after an integer. I've already tried putting
inside and outside variable y and i still can't get my desired result. Here's the output of my code.

https://i.sstatic.net/FWvtl.jpg

Upvotes: 2

Views: 65

Answers (1)

Koby Douek
Koby Douek

Reputation: 16675

Since you are using document.write, what you need is a HTML line break, not a Javascript line break.

Try using <br>:

var y = 21.5;
var num = 10; 

document.write(y + '<br>');
document.write(num == 8);

Upvotes: 1

Related Questions