Guest User

Untitled

a guest
Feb 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. var els = document.getElementsByClassName("myclass"); // Creates an HTMLObjectList not an array.
  2.  
  3. Array.prototype.forEach.call(els, function(el) {
  4. // Do stuff here
  5. console.log(el.tagName);
  6. });
  7.  
  8. // Or
  9. [].forEach.call(els, function (el) {...}); // Creates array on the fly.
Add Comment
Please, Sign In to add comment