r.mark.volkmann at gmail.com
Sat Aug 22 21:32:17 UTC 2015
Ah, yes. I was getting that confused with what is returned by the Array
methods entries, keys, and values which is an object that is both iterable
and an iterator.
Thanks for clarifying that the value after "of" in a for-of loop must be an
iterable, not an iterator.
On Sat, Aug 22, 2015 at 10:42 AM, Alexander Jones <alex at weej.com> wrote:
> Arrays are not iterators - they have no `next` method. '`for-of` works on
> On Saturday, August 22, 2015, Mark Volkmann <r.mark.volkmann at gmail.com>
>> I understand Arrays in ES 2015 are both iterable (have Symbol.iterator
>> method) and iterators (have next method). Suppose I create a custom object
>> foo that is iterable, but not an iterator because the Symbol.iterator
>> method returns a different object bar. According to the spec, should I be
>> able to use either foo or bar after "of" in a for-of loop?
R. Mark Volkmann
Object Computing, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss