I understand the way it is used, but I don't understand why.   "for-of"
could have been spec'd to take either an Iterable (an object with an
[Symbol.iterator] method) or an Iterator.  Or just an Iterable.

On Mon, Jul 25, 2016 at 8:38 AM, Boris Zbarsky <[email protected]> wrote:

> On 7/25/16 11:19 AM, John Lenz wrote:
>
>> Can anyone provide any historical context on why this method was added
>> to the "iterator"?
>>
>
> The idea is that you can do this:
>
>   for (var something of myarray.entries())
>
> and similar for other iterator-returning methods.  The way for-of works is
> that it will try to call iterator() on the thing to the right of the "of",
> which in this case is an Iterator instance.
>
> -Boris
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to