Language concepts

Iterator protocol

Try the free JavaScript compiler

A synchronous iterator exposes next returning an object with value and done; optional return and throw support cleanup and exceptional interaction. The iterator is not automatically iterable.

Formal Syntax & Structure

javascript syntaxjavascript
iterator.next()

Working Example

Example Snippetjavascript
const it=[7].values();console.log(it.next().done,it.next().done);
JavaScript Reference