Javascript Array extension

后端 未结 3 969
再見小時候
再見小時候 2021-01-28 11:47

Just wonder. I have extended javascript Array object using its prototype as follows:







        
3条回答
  •  清酒与你
    2021-01-28 12:05

    for..in iterates over the (non built-in) properties of an object. Do not use it to iterate through an array. Just use a regular for loop.

    Read this link https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/for...in#Description

提交回复
热议问题