Answer the question
In order to leave comments, you need to log in
Why does the console always return 10?
function ramdom(max, min) {
return Math.floor(Math.random() * (max - min) ) + min;
}
var x = function() {
var z = ramdom(10,10);
return console.log(z);
};
setInterval(x, 100);
Answer the question
In order to leave comments, you need to log in
The minimum and maximum are the same, so their difference is zero. Adding the minimum gives the result. In order to produce different numbers, you need to supply other input parameters to the user-defined rundom function.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question