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 trialJose Ramirez
9,946 PointsMath.round()
how to alert the temperature of the problem. This is how I wrote the code alert(Math.round(3.5)
var temperature = 37.5;
alert(Math.round(37.5);
<!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
Joe Nguyen
25,189 PointsThe 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!
Ross King
20,704 PointsHi 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
9,946 PointsThank you all for seen my mistakes.
Jose Ramirez
9,946 PointsRoss. Thank you very much