0
aanastasiia-tilikina
The code generates a number between 1 and the numbers array's length.
Shortcut: getrandom
getrandom
0 Comments
function generateRandomNum() { const numbers = [2, 2, 2, 2, 2, 2, 2, 2, 4, 4]; const idx = Math.floor(Math.random() * numbers.length); return numbers[idx]; }