Iterator.prototype.reduce()
Iterator.prototype.reduce() is a JavaScript method in the Iterator category. Reduces to single value. The syntax is iter.reduce(callbackFn, initial). A typical example: Iterator.from([1,2,3]).reduce((a,b) => a+b, 0) // 6. A close sibling is yield, which pauses a generator. A close sibling is Iterator.prototype.every(), which tests if all values pass a test. A close sibling is Iterator.prototype.find(), which returns the first value that passes a test. A close sibling is Iterator.prototype.some(), which checks if any value passes a test. More about this category: Iterator and generator methods. Related Iterator methods: yield, Iterator.prototype.every(), Iterator.prototype.find(), Iterator.prototype.some(), Iterator.prototype.forEach(), Iterator.prototype.toArray(). This page is part of the free JS Reference documentation covering 1027+ methods, each with syntax, parameters, return values, examples, and common pitfalls. You can try Iterator.prototype.reduce() immediately in the JavaScript playground, look up unfamiliar terms in the glossary, or return to the JS Reference homepage.