I'm in the middle of a simple app, the idea is to randomly pick up without repeating the values โโof an array.
I managed to do it through a function but at the moment I started to go through it I got two undefined and I do not know why
Sample of code :
var num = [1, 2, 3, 4, 5, 6, 7, 8, 9];
cont = 0;
totalnum = num.length - 1;
function next() {
var indice = Math.floor(Math.random() * (cont < totalnum ? ++cont : 0));
var number = num[indice];
document.getElementById("hola2").innerHTML = num.splice(indice, 1);
}