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
Elizabeth Mawer
9,554 PointsJavaScript
Hi
I'm doing a challenge question and am struggling to find the answer. It is using the Math.round function.
My code is as below:
var temperature = 37.5; Math.round(37.5) alert('temperature is ' + Math.round);
I get the prompt:
temperature is function round() { [native code] }
How do I get the prompt to show me the rounded number please?
1 Answer
Andres Altuve
16,274 PointsHi Elizabeth,
Try this:
var temperature = Math.round(3.75);
alert(temperature);
Elizabeth Mawer
9,554 PointsElizabeth Mawer
9,554 PointsOf course that makes perfect sense! Thanks