Ver Mensaje Individual
  #5 (permalink)  
Antiguo 03/12/2010, 16:24
Avatar de _cronos2
_cronos2
Colaborador
 
Fecha de Ingreso: junio-2010
Mensajes: 2.062
Antigüedad: 13 años, 11 meses
Puntos: 310
Respuesta: validacion de array

A mí me gusta más así, se parece más al JS nativo:
Código Javascript:
Ver original
  1. Array.prototype.buscar=function(elemento){
  2.  for(i=0;act=this[i];i++){
  3.   if(elemento===act){
  4.    return true;
  5.   }
  6.  }
  7.  return false;
  8. }
  9. var arr=['Hola','mundo'];
  10. if(arr.buscar('Hola')) alert('Encontrado');
Saludos (:
__________________
" Getting older’s not been on my plans
but it’s never late, it’s never late enough for me to stay. "
Cigarettes - Russian Red