Iteración más rápida (con menos texto) en javascript


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // En lugar de usar un bucle for, podemos hacerlo así:
  2.  
  3. var links = document.getElementsByTagName('a'), i = links.length;
  4. while(i--){
  5. var title = links[i].getAttribute('title');
  6. // bla, bla, bla
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.