isIterator(null); // false isIterator(undefined); // false isIterator("null"); // false (Strings are iterable but not iterators) isIterator([]); // false (Arrays are iterable but not iterators) isIterator({ next:function() { returntrue } }); // true, iterators must contain a "next" function
Checks if the type of value looks like an iterator instance (contains a next function).