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

This dialog box has WAY too few characters to represent my question. Math.round doesn't round .5 down.

The question's expected result is unclear. Math.round doesn't round .5 down - I checked the MDN. Therefore, the only way I can see offhand is to round the number, then subtract 1 from the result. I'm sure there are many different ways to do this, but if you want a different answer, you need to provide more info to guide the result.

My solution does work, and provides both expected answers - 38, then 37.

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

6 Answers

Thanks for taking a look, Samuel. Here's some detailed documentation for Treehouse's consideration.

Summary

Here's the issue. You are looking at this from the viewpoint of an experienced developer. To YOU, Math.floor is very basic. However, if you don't know that Math.floor exists, the context of the question becomes too vague given that the solution to every problem up to now has been built with things explicitly introduced in the videos. Dave doesn't give the student permission to go outside this invisible, but absolutely essential, boundary that allows online grading to occur. Therefore, there is a reasonable chance that this is causing problems for more than one student, and because it's easy to address, could be fixed to the benefit of every future student.

Framing Online Grading

How intelligent can the code vetting function be?

Is it complete enough to handle every possible solution? Obviously not - that would be a Herculean task. So, how do you solve that problem? By setting an expectation with the student about the expected format of the required answer. In this case, the student has an explicit understanding that the challenges are solved by methods, objects, etc., that have already been introduced. Otherwise, how does a student, who may already know some JS, frame an answer that is gradable by the existing logic?

Example

Earlier, Dave wrote code that, if I remember right, is more efficiently solved by a loop. I could have answered the question with a loop, but it would have been marked wrong, even if the code solves the problem. This is the same thing - Math.floor isn't introduced until the next segment, and therefore is implicitly "off-limits".

An Example Solution - One of Several

Dave does introduce the MDN in that segment, for at least the second time. The question can be framed, like I said in a previous post, by telling the student they are allowed (or required) to go to the MDN and find the answer. That explicit permission tells the student that the code will be evaluated by something not explicitly stated in the lesson. With that permission in hand, the "floor" clue now gains context:

  1. I'm to go to the MDN
  2. to the Math object
  3. to look for some rounding property related to "floor"

It's a simple change, stays within the context of the lesson, and actually enhances the student's abilities by giving them a simple exercise in research.

Approach

One of the biggest problems in online learning improvement is that very, very few people will take the time to provide meaningful feedback. When someone does, you can be sure that they are speaking for more than just themselves. Personally, I have better things to do than write this stuff - it's 2 AM, after all - and I bet you do too. However, I also understand that nothing gets better without someone taking the time to say something.

Here's where an insidious block to improvement sees light:

Users are stupid

Really? All users? (BTW, MS is removing the CR/LF after the blockquote, and I'm too tired to research it)

Let me ask you a question. Since I don't know you, I'm going to have to use poor Dave, who can choose to defend himself later (grin).

Would it be unusual to say that Dave knows more about JS that I do? Probably not, right? However, is that a safe assumption? Maybe I'm doing research on the coherence of online learning environments, and looking for this stuff is my "job"? That's not the case, certainly, however I do have a couple of decades of IT under my belt.

I was also trained as a submarine nuclear reactor operator. Would it be reasonable for me to assume that Dave doesn't know as much about that subject as I do? Probably - but stranger things have happened. If I moved from that into code, then why not Dave? True story - I went to work for a little IT job shop in Santa Cruz, and the owner had a Ph.D. in nuclear engineering. The very next IT job I went to, my boss, who was from Moscow, Russia, had a masters in - you guessed it - nuclear engineering. To top it off, there was a guy in the department, which had about 20 people, who 15 years prior was on the same sub, in the same part of the boat, at the same time as me. Yup.

The point, however, is to not get into a CPU measuring contest with the users.

Dave is a reasonably intelligent human being and so am I. It's not hard for me to give Dave the respect of listening to his opinion when he decides to provide it on any subject, because I know he has a reason for taking his time to do so. He will frame it intelligently, and provide the level of detail he believes is required to make his case. He's not stupid, and I can tell by the effort he puts into his case. I know that I can learn from his perspective.

So, instead of saying "Why should we change it - I don't understand why it's a big deal", (which I can no longer see in your post), maybe you could give me, from my perspective, some credit and instead ask "why not change it?". Does my explanation carry positive merit, whatever value you assign to that merit? Would it be hard to change the wording of the question? I believe this is pretty low-hanging fruit, and both the concept and the specific example solve an actual existing problem that I had with a question in the challenge.

Conclusion

Be careful of assuming that your perspective is the only one that is valid. Users are rarely stupid, and if someone takes the time to provide more than 3 words, you can be sure it's because it means enough to them to take their own valuable time to tell you about the real problem they experienced. Assume they are intelligent, and you will benefit from the experience of every single student who takes the class.

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

Hi Jack Cain,

Thanks for the feedback. Changing the word is an excellent suggestion and is a big improvement. I've reworded the challenge as you suggested to say:

You'll need to check the Mozilla Developer Network to find the proper Math method for this (hint: down is toward the "floor".)

Hi Brandon,

Thanks for the input! Of course, math.floor IS the right answer, but the hint given in the question isn't enough. My point is really to the Treehouse guys, so they can see if a change in wording is appropriate.

To Treehouse:

Telling me rounding down is towards the floor makes me wonder why that would be said, not provides a clue, because the reference is too vague.

If it said something like "Use the MDN to find the Math object that will round the number down" and THEN said "toward the floor", I would know where the reference to "floor" came from. Per the previous videos, answers to questions have always been using items presented in the video as the answer. If that is to change, the student needs to know specifically.

Hey Treehouse - I found the answer. Your question about Math.floor comes one video before you mention it. Unless you did this on purpose, that question should be moved to the right section.