What I would like to do is a while, where I was previously asked to indicate a name that is included in an array, and finally show me the position of the array where the name is inserted.
The code is as follows:
<script>
var Amigos = newArray ("EVA", "DIANA", "MARIO", "LOLI", "GHEORGHE", "LUCIA");
var Ultimo = Amigos.length;
var Posicion = 0;
var Vbusca=prompt("Introduce el nombre");
while(Amigos[Posicion] != Vbusca && Posicion<Ultimo ){
Posicion++;
}
if(Amigos[Posicion]==Vbusca){
alert("La posición donde se encuentra " + Vbusca + "es la posición: " + Posicion);
}
else {
alert("El nombre que buscas no está en la lista");
}
</script>