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

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 Basics
  4. JS in Depth
  5. JS Reference
  6. DOM
  7. SVG
  8. JS Misc