Created
May 22, 2016 04:57
-
-
Save kodamirmo/a1d9c5ba7604eb023c56d37b24a3c37d to your computer and use it in GitHub Desktop.
Codigo JS de Smash Faces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arregloNombres = | |
['Irving', 'Emmanuel' ,'Gonzalez']; | |
// 0 1 2 | |
function enteroRandomEnRango(min, max) { | |
var numero = Math.random() * (max - min) + min; | |
var entero = Math.floor(numero); | |
return entero; | |
}; | |
while (arregloNombres.length > 0) { | |
//Ver el tamaño del arreglo | |
var tamano = arregloNombres.length; | |
//Generamos el numero al azar | |
var indice = enteroRandomEnRango(0, tamano); | |
console.log(arregloNombres[indice]); | |
console.log(arregloNombres[indice] + '.jpg'); | |
arregloNombres.splice( indice ,1); | |
console.log(arregloNombres); | |
//splice(cortarDesde, cuantosElementos); | |
//Aqui ya tengo un nuevo areglo | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment