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 trialSun Min
2,941 Pointswhy my code is not running after i put h1 tag
how to use h1 tags in js file?
my code is not running after i put h1 tag
var message = Math \with the numbers ' + firstNum + ' and ' + secondNum; document.write(message);
how should i put h1 tag?
4 Answers
Adam Tarabichi
1,965 Pointsvar message1 = '<h1>'+"Math with the numbers " + number1 + ' and ' + number2 +'</h1>'; i had a lot of trouble putting in the <h1> tag with the concatenations and variables but this is how I fixed it
hongloanbui
2,649 PointsNeither of those 2 solutions worked for me. Any other advise??
Dylan Carter
1,046 Pointsi did it like this:
var message = `<h1>Math with the numbers ${numberOne} and ${numberTwo}</h1>`
Larry Coonrod
5,041 PointsHere is how to include the h1 elements with document write message. Key is that the quotes enclose the html elements as well as the message itself. document.write("<h1> Your Message Here</h1>"_)