Cannot integrate Math.floor to randomNumber


#1

https://www.codecademy.com/courses/learn-javascript/lessons/control-flow/exercises/random?action=lesson_resume

Not allowing me to work Math.floor into random.Number. Im anaged to get randomNumber to work correctly, but cannot integrate Math.floor.

Did you wrap Math.random() * 100 with Math.floor()?


var randomNumber = Math.random = Math.floor (8.6) * 100 ;

console.log(randomNumber);


#2

Is this for the exercise or you'r just playing around with it?


#3

You set a variable to two different things in the same line. If you're trying to run Math.floor on Math.random, use this syntax.

var randomNumber = Math.floor(Math.random() * 100);

#4

It works now. Thank you for your time.


#5

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