for/in loop

[size=medium]JavaScript arrays are simply a specialized kind of object. Therefore, the for/in loop enumerates array
indexes as well as object properties.

The for/in loop does not specify the order in which the properties of an object are assigned to the
variable. There is no way to tell what the order will be in advance, and the behavior may differ among
implementations or versions of JavaScript. If the body of a for/in loop deletes a property that has not yet
been enumerated, that property will not be enumerated. If the body of the loop defines new properties,
whether or not those properties will be enumerated by the loop is implementation-dependent.
The for/in loop does not actually loop through all possible properties of all objects. In the same way that
some object properties are flagged to be read-only or permanent (nondeletable), certain properties are
flagged to be nonenumerable. These properties are not enumerated by the for/in loop. While all userdefined
properties are enumerated, many built-in properties, including all built-in methods, are not
enumerated.
[/size]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值