Random

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

I need help with 8/9 exercise https://www.codecademy.com/en/courses/learn-javascript/lessons/control-flow/exercises/random

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
My code is like this: Math.floor(Math.random() * 100);

```

The error message I keep getting is: Do the parentheses of Math.floor() wrap around the Math.random() * 100 expression?

Thanks so much for your great help!

<do not remove the three backticks above>

HI in your code

 Math.floor(Math.random() * 100);

you didn’t close Math.floor() it’s missing the closing )

Are you sure? Looks fine to me…

1 Like

@jibblyj My bad :grimacing:
@lavincreative can you post all your code?

1 Like

The requirement of the exercise says:
Put randomNumber’s value inside the parentheses of Math.floor().

So my code is like this:
var randomNumber = Math.random() * 100;
console.log(randomNumber);
Math.floor(Math.random() * 100);

This line

var randomNumber = Math.random() * 100;

like the error says…
Do the parentheses of Math.floor() wrap around the Math.random() * 100 expression?
it’s on this line that you should put the Math.random() * 100 inside Math.random()
then remove this line (the last line)

Math.floor(Math.random() * 100);

How can I remove the last line? It asks me to use Math.floor().

YOu shoudl use Math.flo… on this line

var randomNumber = Math.random() * 100;

put it around Math.random() * 100

1 Like

I see. Thank you sooo very much. Now it works. Really appreciate your help.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.