2009-06-25_235638A great speech from Nicholas C. Zakas points out that the following pattern for JavaScript loops (19:55) uses simpler syntax and performs better:

var i = values.length;
while (i--){
  process(values[i]);
}

Nick’s slide at 22:25 sums it up, “Work Avoidance.”


Be Sociable, Share!

    Leave a reply

    required

    <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>