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 Introducing the Practice

My code works!- JavaScript Math Methods Practice.

// Alert Message 
var intro = alert("Let's get mathmatical!");

var userInput = prompt("Enter a number you wish to get mathmatical with.");

// 4. Convert that value from a string to a floating point number
userInput = parseFloat(userInput);

// 5. Repeat steps 3 and 4 to create a second variable and collect a second number
var userInput2 = prompt("Enter another number you wish to get mathmatical with.");
userInput2 = parseFloat(userInput2);      


//Message with <h1> numbers from user.
var message = (`<h1> Math  with the numbers ${userInput} and ${userInput2}.</h1>`);
var add = userInput + userInput2;

// 7. Add another string to the message variable. 
message += (`<p>${userInput} + ${userInput2} =${userInput+ userInput2}<br>
  ${userInput} * ${userInput2} = ${userInput * userInput2} <br>
  ${userInput} / ${userInput2} =  ${userInput / userInput2}<br>
  ${userInput} - ${userInput2} =  ${userInput - userInput2}<br>
It's <strong>MATHMATICAL!</strong></p>`);

// 10. Use the document.write() method to print the message 
document.write(message);