5 ms·
To be fair, they do note this shortcoming. "Note that this trick should only be used for arrays which you know do not contain "falsy" values (arrays of objects
by freakwit 16y ago
To be fair, they do note this shortcoming.
"Note that this trick should only be used for arrays which you know do not contain "falsy" values (arrays of objects or DOM nodes for example). If you are iterating over numeric data that might include a 0 or string data that might include the empty string you should use the i, j idiom instead."
- WilliamLP 16y agoSo it should be used approximately never in real code.