How do you generate a random integer number in range from 1 to 10 in JavaScript?
Explanation
Math.random() method returs number in range 0 (inclusive) and 1 (exclusive). Math.floor() method rounds a number downward to its nearest integer Example:

var randomNumber = Math.floor(Math.random()*11);
where 11 dictates that the random number will fall between 0-10.

@iliana000, fixed! Thanks a lot ;)

2016 Jan 20, 6:00:10 PM

and "randoM"

2016 Jan 15, 6:31:57 AM

When will you check this mistake? It isn't told in the aswer, that the result should be INTEGER. Do you ever read comments? (on quizful.net)

2016 Jan 15, 6:31:33 AM

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты