JavaScript for…in vs for

前端 未结 22 1467
悲哀的现实
悲哀的现实 2020-11-22 07:15

Do you think there is a big difference in for...in and for loops? What kind of \"for\" do you prefer to use and why?

Let\'s say we have an array of associative array

22条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 07:20

    For in loops on Arrays is not compatible with Prototype. If you think you might need to use that library in the future, it would make sense to stick to for loops.

    http://www.prototypejs.org/api/array

提交回复
热议问题