javascript random number inclusive code example
Example 1: javascript generate a random integer number in a range of numbers
const min = 1;
const max = 4;
const intNumber = Math.floor(Math.random() * (max - min)) + min;
console.log(intNumber); //> 1, 2, 3
Example 2: random function javascript
let object = random(0, 50);
// making "object" a random number between 0 and 50.
console.log(object);
// printing object in the console