Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
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!
var temperature = 37.5; temperature = alert(Math.round(temperature)); temperature = alert(Math.floor(temperature));
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!