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 The Solution

Miguel Rivas
Miguel Rivas
1,182 Points

my code can run until the message variable!! Can somebody check this code and tell me what is wrong with it!!

alert("Let's do some math");

var number1 = prompt("what number is on your mind??");

number1 = parseFloat(number1);

var number2 = prompt ("Give a another number!!");

number2 = parseFloat(number2);

var message = "<h1> Math  with  numbers " + number1 + " and " + number2 "</h1>";

document.write(message);
Rich Donnellan
Rich Donnellan
Treehouse Moderator 27,708 Points

Question updated with code formatting. Check out the Markdown Cheatsheet below the Add an Answer submission for syntax examples.

2 Answers

hello Miguel. you are missing a + In your message variable

// you wrote
var message = "<h1> Math with numbers " + number1 + " and " + number2 "</h1>";

// it should be
var message = "<h1> Math with numbers " + number1 + " and " + number2 + "</h1>"; // 
Jordan Faulds
seal-mask
.a{fill-rule:evenodd;}techdegree
Jordan Faulds
Full Stack JavaScript Techdegree Student 2,315 Points

THANK YOU for this. I didn't realize I needed to concatenate the closing header tag, and I was losing my mind trying to spot the problem.

Chris Goyette
Chris Goyette
2,910 Points

omg. i forgot a plus after my first string. #MINDBLOWN.

Thank you!