Ver Mensaje Individual
  #3 (permalink)  
Antiguo 07/03/2013, 16:52
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: Re indexar un array en JavaScript

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <title>titulo</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6.  
  7. <script type="text/javascript">
  8. //<![CDATA[
  9. var arreglo = {'nombre':'juana', 'apellido':'galvis', 'direccion':'Carrera 12'};
  10. console.log(arreglo['nombre']); //juana
  11.  
  12. for (var llave in arreglo){
  13. console.log(llave);
  14. }
  15.  
  16. for (var llave in arreglo){
  17. console.log(llave + '-'+ arreglo[llave]);
  18.  
  19.  }
  20.  
  21. //]]>
  22. </head>
  23.  
  24. </body>
  25. </html>
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.