There is an array with 54 cards with random numbers. I get 9 values, but periodically they are repeated, looking for topics to exclude duplicate numbers, but in this case it leaves an empty value in the array and does not fill it with a new number.
//3апись 9 id в массив randId var randId = new Array(9); for (var i = 0; i < randId.length; i++) { // В таблице 9 строк var rand = Math.floor(Math.random() * cards.length); if (randId.indexOf(rand) === -1) { // проверим есть оно у нас или нет randId[i] = rand; } }