2
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

1
  • its rather a linebreak in html... Commented Jun 4, 2017 at 11:06

1 Answer 1

1

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);

Sign up to request clarification or add additional context in comments.

2 Comments

Hey Koby I have deleted my answer, after you have altered your answer from `\n´ to my solution... ;-)
Thanks koby! My code is now working. I just need to put "+" after an integer to insert linebreak.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.