It is possible to use for-in loop for arrays,
BUT
- it can cause some dodgy logical errors
- order of listening the properties can be a little bit random (It's not quaranteed)
Just remember:
use for loops with arrays and for-in loops for objects .
Source: Stoyan Stefanov - JavaScript Patterns - O'Reilly(2010)
No comments:
Post a Comment