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

Can't seem to get off this question....

Am i missing something here? :/ Everything looks correct but, it keeps feeding me the "Bummer" response. Thank you!

script.js
var temperature = 37.5;
temperature = alert(Math.round(temperature));
temperature = alert(Math.floor(temperature));
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

By assigning alert to temperature you are losing the original value of temperature = 37.5. The challenge just asks for the alert statements themselves.

Bummer: Did you give the Math.floor() method the variable temperature like this Math.floor(temperature)?...... is the response i keep getting today.

i believe it has something to do with the platform. bases on the error response, everything looks to be in order. it worked fine yesterday the way it's posted here. the original value of the variable shouldn't be the issue, since it tells you to change the value" Open an alert dialog a second time and display the temperature variable rounded downward to the nearest integer."

I changed the value using the Math.round() method anyways in the first question. so, I don't think that's the issue. Thank you!

math.round() returns the rounded value but doesn't change the original argument. To see this try the following code:

var temperature = 37.5;
alert(Math.round(temperature));
console.log(temperature);
alert(Math.floor(temperature));
console.log(temperature);

In order to change the value you would need an assignment:

temperature = Math.round(temperature)

Since alert doesn't return anything in your code you are passing a value of undefined to Math.floor()

It makes sense now. That would make sense why the first time I wasn't getting the error but, the second time I was. i suppose i was doing it right yesterday....which is why i repeat until it completely makes sense. so, thank you!