12569 Views
In Javascript sometimes you need a Random Integer. Here is the best way to get Random Integer number in Javascript.
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
Test the function:
console.log("Random ...
Sheetal Kumar
Jan 07, 2019