TypeError when it is created if the value's [Symbol.iterator] isn't null, undefined or a function, from
its next() (the iterator isn't checked when it is created) when the value's [Symbol.iterator]() doesn't return an
iterator or the source's next() (or return(), when the count is reached) returns a value which is not an object,
and from its return() when the source's return() returns a value which is not an object
Creates a lazy iterator that yields at most
countvalues. The value is processed likefor...of(and iterForOf), so an iterable (including a string or an array) is processed using its iterator (a string by its code points on a runtime which supportsSymbol.iterator) and an iterator which is not iterable is used as-is. Unlikefor...of(and iterForOf, which only also processes an array) any other array-like which is not iterable (eg.{ length: 2, 0: "a", 1: "b" }, orargumentsor a string on a runtime withoutSymbol.iterator) is processed using its indexes. AMaporSetwhich is not iterable (eg. on IE 11) is processed using a copy of its[key, value]entries / values, which is made when this is called (rather than when the first value is read), so a value added after that is not processed. Like the native iterator helpers a TypeError is thrown when the source'snext()returns a value which is not an object, the source is closed (by calling itsreturn()with no arguments) once the count is reached, it is done once the source throws, and itsreturn()only closes the source when it isn't already done. Unlike the nativetake(), a negative orNaNcount is used as 0 (so the source is closed by the firstnext()) rather than throwing aRangeErrorwhen it is created, and a fractional count is truncated.