Random number between --10 and 50


#1

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

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-javascript/lessons/introduction-to-javascript/exercises/random?action=lesson_resume

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
My code behaves perfectly. I just wanted to know if I want to generate a random number between say -10 and 50, how does that work because this exercise returns a positive random number only.

```

Replace this line with your code.

<do not remove the three backticks above>

#2

in this exercise to get a random number between 0 and 50 the instructions give you this:
Math.floor(Math.random() * 50);
so if you wanted between -10 and 50 you could just change that to:
Math.floor(Math.random() * 60 - 10);


#3

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