JS: Iterator-like object and Proper Iterator

By Xah Lee. Date: . Last updated: .

What is iterator-like object

iterator-like object is an Iterable Object but not in the prototype chain of Iterator.prototype.

History

in ECMAScript 2015 , Iterable Object were created, together with Iterator Object, as mechanism to make iterable work.

anything conforming to Iterator Interface is called an iterator.

after 10 years, it was realized that it's nice to have iterators belonging to an iterator class as their prototype. so in ECMAScript 2025, the Iterator (class) was created.

What is proper iterator

Proper iterator means a iterator that is descendant of Iterator.prototype

all standard buildin iterators are proper iterators since ECMAScript 2025.