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 JavaScript Basics (Retired) Working With Numbers Using Math Methods

Jose Ramirez
Jose Ramirez
9,946 Points

Math.round()

how to alert the temperature of the problem. This is how I wrote the code alert(Math.round(3.5)

script.js
var temperature = 37.5;
alert(Math.round(37.5);
index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

4 Answers

The alert method looks like this alert() on your's you have alert(Math.round(37.5); but you haven't exactly finished ending the alert method since you only have one parenthesis for the alert() all you need to do is add it to the end for example alert(Math.round(x));

Hope that helps!

Hi Jose Ramirez ,

You have the right idea and your answer is almost correct but you are missing a closing parenthesis on the alert.

Tip You are writing code that repeats itself, remember DRY (Don't Repeat Yourself) principals in programming.

To pass this challenge, use the temperature variable when creating the alert. By using this variable you only ever need to update one part of your code when producing the alert.

var temperature = 37.5;
alert(Math.round(temperature));
Jose Ramirez
Jose Ramirez
9,946 Points

Thank you all for seen my mistakes.

Jose Ramirez
Jose Ramirez
9,946 Points

Ross. Thank you very much