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

Why is my code not passing? It seems correct!

I'm doing https://teamtreehouse.com/library/javascript-basics-2/working-with-numbers/using-math-methods

In challenge task 2, according to me, it should work.

var temperature = 37.5;

But it's not!

var temperature = 37.5;

  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="script.js"></script>

2 Answers

Hi Santosh,

Do you still have the code in from task 1? I just checked it on my end and it worked fine with the following code.

var temperature = 37.5


Yes, The previous code needs to be there.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

Indeed, yes you're right, we're using 2 methods here across both tasks :)

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

The code is correct, but you need to use Math.round instead of Math.floor()

We're rounding the number up instead of down. :-)