Timeline for javascript for-in loop
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 20, 2020 at 9:12 | history | edited | Community Bot |
Commonmark migration
|
|
| Apr 1, 2013 at 1:28 | vote | accept | Maizere Pathak.Nepal | ||
| Mar 31, 2013 at 16:48 | comment | added | Darin Dimitrov |
arr.length returns only the number of elements in the array, properties are ignored. But an array could also contain properties. Consider the following code for example: var arr = [1, 2, 3]; arr.foo = 'bar';. Now arr.length will return 3 but try a for...in loop and you will see the mess it creates. You should not use for...in with arrays. Javascript is a strange beast indeed.
|
|
| Mar 31, 2013 at 16:46 | vote | accept | Maizere Pathak.Nepal | ||
| Mar 31, 2013 at 16:46 | |||||
| Mar 31, 2013 at 16:40 | comment | added | Maizere Pathak.Nepal | if u do arr.length output is only 3 ,this means that properties are not counted right?Only argument.And how can the argument be properties ? | |
| Mar 31, 2013 at 16:30 | history | answered | Darin Dimitrov | CC BY-SA 3.0 |