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

Mary Paul
Mary Paul
13,792 Points

H1 not printing - Some javascript math practice

Hey, so trying to do this and not sure what I'm doing wrong- the program runs, alerts and inputs pop up, but the h1 below never prints. Is it because of the updates? What am I missing?

let message = "<h1>Math with the numbers" + x + " and " + y + "</h1>";

Thanks.

Matthew Long
Matthew Long
28,407 Points

Are you selecting the element? Try logging message out to the console.

2 Answers

Mary Paul
Mary Paul
13,792 Points

I'm honestly not sure what happened but when I switched to template literals it started working! Thank you.

:)

Hey Mary! Glad you got it working. You can mark the question as solved by selecting a 'Best Answer' :) And if you can, share your code that worked so we can all learn from it!