Closed Xotic750 closed 5 years ago
Yes, looks to be a think-o dating from f77f9f52ccc4765a0674a001fd1f258fdd7cf58a. The current spec is https://www.ecma-international.org/ecma-262/6.0/#sec-%arrayiteratorprototype%.next and doesn't have a for loop. (I think the for loop was from some intermediate stage where we were expecting to skip entries in sparse arrays.)
Of course it loops - it just doesn't have an initializer, because var i = this.i
is already done higher up in the function.
There certainly may be a better way to express it, but there's nothing broken about it.
Ok, I don't think that I'd describe it as a loop as it returns unconditionally, I wasn't suggesting that it was broken more a strange use of for
.
Going to close this; but if there's a compelling reason to refactor that code (including "is much clearer to read") then a PR would be welcome!
https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L1055
Is this a mistake? Surely just an
if
?