Hacker News new | ask | show | jobs
by nailer 4185 days ago
I started in OSes and filesystems, but I recommend hitting Cmd+Alt+i on this page and typing:

    var comments = document.querySelectorAll('.comment');

    [].forEach.call(comments, function(comment){comment.style.backgroundColor = "#ffaa44"})
Instead.
1 comments

Array.prototype.forEach.call(..) is more efficient because it doesn't create a new array.
Fixing NodeList.prototype.forEach() is best because it doesn't read awfully but this is someone learning to program, not to fix the DOM API.