array is a reserved word in jquery? [closed]

-7

Good morning. array is a reserved word in jquery?

var indices= [];
    var generarAleatorios = function(array){
        if(indices.length<array.length){
            while(indices.length<array.length){
                var numAleatorio = Math.floor(Math.random()*array.length);
                //verificar que el numero aleatorio no haya salido
                if(indices.indexOf(numAleatorio)==-1){
                    indices.push(numAleatorio);
                    console.log(indices);
                    return numAleatorio; 
                }       
            }   
        }else{
            alert("no hay mas fotos, ganastes el juego");
        }
    }

I HAVE THIS CODE AND I DO NOT UNDERSTAND EXACTLY. THANK YOU FOR YOUR HELP

    
asked by Flor 03.10.2017 в 21:30
source

1 answer

1

The truth is that you do not understand your code very well or say what you want to achieve, could this be what you are looking for ?:

var indices = [];
var generarAleatorios = function(indices) {

    if(indices.length > 0){

    } else{
        alert("no hay mas fotos, ganaste el juego")
    }
}

generarAleatorios();

Answering your question:

At array , you can call it array no problem

var array = []; //Esto es valido
    
answered by 03.10.2017 в 21:49