Home » HTML » Html miscellaneous » Question
  1. Math.random() returns _______________.
    1. random number between 0 and 10
    2. random number between 1 and 100
    3. random number between 1 and 10
    4. random number between 0 and 1
    5. None of these
Correct Option: D

Math.random() generate any random number between 0 and 1. If we use Math.random() with Math.floor() it returns any random integer. E.g. Math.floor(Math.random * 1000); It will generate any random number between 0 and 999. For the sake of convenience we can also define a random function.



Your comments will be displayed only after manual approval.