I\'m new to javascript and trying to get comfy with Functions, For loops, and If statements. I\'m working on a simple exercise that genera
There are many ways to solve this problem. I am contributing my way of solving it.
function randoNumbers(min, max) {
let randomNumbers = [];
for (; randomNumbers.length < 5;) {
const value = Math.floor(Math.random() * (max - min) + +min);
if (!randomNumbers.includes(value))
randomNumbers.push(value);
}
console.log(randomNumbers);
}
randoNumbers(1, 10);