Code Challenges: JavaScript Fundamentals (Fix the broken code)

Hello, i’m currently trying this challenge and do have two “questions”:

  1. If I’m not totally blind i think the instructions do not mention anything about whole numbers. How am i expected to know that the function is supposed to only return whole numbers without expanding the hint? The comments in the code do not suggest anything in that direction either. 5.5 is a number just like 5.

  2. I added a single line of code (console.log(rollTheDice());) to debug the function and that was enough to pass the challenge so i think something is wrong with your tests:

But which dice doesn’t have whole numbers? The standard dice has numbers from 1 to 6. I think that can be anticipated.

Yea, maybe you’re right. Sometimes I tend to be too nitpicky. :sweat_smile:

1 Like

Yes maybe. :smile: At least I wouldn’t have been very delighted if there had been a whole novel about dice in general which may have numbers like 5.5 but this in this particular exercise and so on before I could have started with the exercise.
You shouldn’t have been able to pass the test by just adding a console though…

1 Like

Yea it’s weird. I am not able to reproduce it though, so unfortunately I have no idea how I managed to pass the test by adding that line. :confused:

By seeing a dice physically and think it logically, I think there’s no way one would think it’s gonna be in decimal :sweat_smile: . For example, the dice only has number 1-6 so yeah it must be in a whole number. And there’s a link which links to Codecademy Forum about the usage of Math.floor().

I already had that conversation with @mirja_t, thanks! :slight_smile: