2 ms·
>old canard about caching the length of an array when iterating over it I think there are still places where you need to do this (please correct me if wrong, o
by jaredsohn 11y ago
>old canard about caching the length of an array when iterating over it
I think there are still places where you need to do this (please correct me if wrong, or mention some other cases):
- when iterating over DOM nodelists in JS (why doesn't the browser cache this as well?)
- if using strlen in C/C++ (for the latter, you should use string.length() instead).