I'm having difficulty with lesson 6 on random numbers; please help?


#1


Replace this line with your code.


#2

You need to:

  1. console.log out Math.random()*100 where Math.random() is used in Javascript to produce a random number between 0 and 1.

console.log(Math.random()*100); //this will console log Math.random()*100
  1. console.log out the value that you will get using Math.floor on Math.random()*100.
    Math.floor() is just taking a decimal number that we got from Math.random()*100 and logs it out as a round number without any decimal places.

console.log(Math.floor(Math.random()*100)); //this will output the round number
// without decimal places that we get from using Math.floor() on Math.random()*100

#3

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