Returning non-object value from iterator.next() will throw

Published: | Categories: JavaScript

Description

In the iterator protocol, the next method always has to return an object with appropriate properties including done and value. Firefox now throws a TypeError when a non-object value such as false or undefined is returned from a developer-defined next method, according to the ECMAScript 2015 (ES6) spec.

References