News for hackers. Stuff that matters.
Re:A Classic JavaScript Interview Question by eastbayjake on Saturday January 24, 2015 @12:42PM (#8940276)
I like your IIFE there. It's more elegant than the way I usually see this one fixed:

  for (var i = 0; i < domElems.length; ++i) {
    domElems[i].onclick = clickHandler(i);
  }

  function clickHandler(n){
    return function(){
      console.log(n);
    };
  }

There are no comments on this comment yet.