|
|
|
|
|
by pluma
4054 days ago
|
|
I think nearly every JS engine now optimizes `for (...;i < arr.length;...)` -- I'm nearly 100% sure V8 does and fairly certain Firefox's and ModernIE's do as well. In fact, even `for` is likely an over-optimization. In nearly all JS code you can get away with just using `forEach` (or its friends). |
|
Caching the array length still gives you a small speed boost in most browsers, but it's probably an over optimisation unless you're doing something really intensive.