JS: Iterator Prototype

By Xah Lee. Date: . Last updated: .

New in ES2015.

Builtin iterators of JavaScript has a prototype object.

[see JS: Iterator]

The Iterator Prototype object is denoted as “%IteratorPrototype%” by the JavaScript spec.

There's no direct syntax for it. But you can get it by

const iteratorProto = Object.getPrototypeOf ( Object.getPrototypeOf ( [][Symbol.iterator] ) );

You can add properties to this iterator prototype, so all builtin iterators will inherit it.


ECMAScript® 2016 Language Specification#sec-%iteratorprototype%-object

JS Iterable ⭐

  1. Interface
  2. Iterable
  3. Iterator
  4. Iterator Prototype
  5. for-of Loop
  6. Spread Operator
  7. Generator
  8. Generator Function
Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials

  1. HTML
  2. Visual CSS
  3. JS in Depth
  4. JS Reference
  5. DOM
  6. SVG
  7. Web Dev Blog