6 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators
7 - https://kangax.github.io/es5-compat-table/es6/#Iterators
8 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Deprecated_and_obsolete_features#Object_methods
12 The `__iterator__` property was a SpiderMonkey extension to JavaScript that could be used to create custom iterators that are compatible with JavaScript's `for in` and `for each` constructs. However, this property is now obsolete, so it should not be used. Here's an example of how this used to work:
15 Foo.prototype.__iterator__ = function() {
16 return new FooIterator(this);
20 You should use ECMAScript 6 iterators and generators instead.
24 This rule is aimed at preventing errors that may arise from using the `__iterator__` property, which is not implemented in several browsers. As such, it will warn whenever it encounters the `__iterator__` property.
26 Examples of **incorrect** code for this rule:
31 /*eslint no-iterator: "error"*/
33 Foo.prototype.__iterator__ = function() {
34 return new FooIterator(this);
37 foo.__iterator__ = function () {};
39 foo["__iterator__"] = function () {};
45 Examples of **correct** code for this rule:
50 /*eslint no-iterator: "error"*/
52 var __iterator__ = foo; // Not using the `__iterator__` property.