JQuery 'each()' method

Just found this sort of holy grail of JQuery looping. As usual, I have little time to elaborate.... so here's what I did:

To show only a specified number of entries in a tag-set. The example here is on a set of divs with class="comment".

  $('#comments .comment').each
  (
    function (idx)
    {
      if(idx>1)
      {
        $(this).css("display", "none");
      }
    }
  );

This is how I used the each method. (In my usage) each() takes a function as a parameter.
The function there takes a parameter which is then used as the iteration index (idx) and can be used and tested against accordingly.
And of course, indexing in javascript begins at 0. So the code above simply builds an array of comments then steps through them with 'each' assigning a display:none to all but the first two.

Technologies: