常见写法:
// original loops for (var i=0; i < items.length; i++){ process(items[i]); } var j=0; while (j < items.length){ process(items[j++]]); } var k=0; do { process(items[k++]); } while (k < items.length);
小改进:
//minimizing property lookups and reversing for (var i=items.length; i--; ){ process(items[i]); } var j = items.length; while (j--){ process(items[j]]); } var k = items.length-1; do { process(items[k]); } while (k--);