Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

how do you tell document.write to write on the next line when you run the thing?

var sPM = 60; var mPH = 60; var hPD = 24; var dPW = 7; var wPY = 52; var sPD = sPM*mPH*hPD; document.write('There are ' + sPD + ' seconds in a day'); var yAlive = 26; yAlive = sPD*dPW*wPY*yAlive; document.write("I've been alive for " + yAlive + " to this point.");

//that's how i did it but it prints on the same line

1 Answer

I think you can add the <br> tag in side your code * after the (seconds in a day)

for example: var sPM = 60; var mPH = 60; var hPD = 24; var dPW = 7; var wPY = 52; var sPD = sPM*mPH*hPD; document.write('There are ' + sPD + ' seconds in a day' + '<br>'); var yAlive = 26; yAlive = sPD*dPW*wPY*yAlive; document.write("I've been alive for " + yAlive + " to this point.");

thanks! :)