for-of loop

Mark Volkmann r.mark.volkmann at gmail.com
Sat Aug 22 14:52:50 UTC 2015


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.


More information about the es-discuss mailing list