javascript - Weird problem with JSMock -


Can anyone say what is happening here, and how to fix it? I am using JSMock, and I am executing the following code in spec.js :

 for  (var t in []) {alert )}  

... warns my browser "every indophobic" (when it should not execute the warning command) it's my every < / Code> is messing up for loop how can i fix it?

The problem is That.

in-in statement means array and For arrays such as 1 objects, to use for enumerate object properties, it is always the regenerator loop, such as:

(var i = 0; i & lt; arr.length; i ++) {// ...}

You will see an array-like object On should be avoided because:

  • The order of repetition is not guaranteed, can not be numerical in the indexed order.
  • Inherit Assets also were calculated is.

See also:

< Sir-like I mean that the sequence Any items with numbered properties and length assets.


Comments