Comment on A re-introduction to JavaScriptparentComments−jaredsohn11yold canard about caching the length of an array when iterating over itI 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).
Comments
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).