New in ES2015.
Note: iterable object allow for-of loop to go thru a object, with potentially infinite number of items. [see JS: for-of Loop]
An interface is a spec for a set of property keys and values.
Any object that has all the properties (or inherited) as described by an interface’s spec, is said to have (conform to) that interface.
Note: by definition, many objects can have the same interface.
Note: by definition, a object can have many interfaces.
When a object confoms to interface X, we say that the object is “X object” or just X. For example, a object that conforms to the iterable interface is called “iterable object”, or just “iterable”.
- Iterable interface
- Iterator interface
- IteratorResult interface
|A function that returns a iterator object.||The returned object must conform to the Iterator interface.|
[see JS: Iterable]
|A function that returns an IteratorResult object.||The returned object must conform to the IteratorResult interface. If a previous call to the
The following are optional:
||A function that returns an IteratorResult object.||The returned object must conform to the IteratorResult interface. Invoking this method notifies the Iterator object that the caller does not intend to make any more
||A function that returns an IteratorResult object.||The returned object must conform to the IteratorResult interface. Invoking this method notifies the Iterator object that the caller has detected an error condition. The argument may be used to identify the error condition and typically will be an exception object. A typical response is to throw the value passed as the argument. If the method does not throw, the returned IteratorResult object will typically have a |
[see JS: Iterator]
|This is the result status of an iterator next method call. If the end of the iterator was reached, |
JS Iterable ⭐
If you have a question, put $5 at patreon and message me.