Standard built-ins
Iterator.prototype.find()
Consumes until a predicate is truthy and returns that value; otherwise undefined. An early match closes the source.
Formal Syntax & Structure
javascript syntaxjavascript
iterator.find(predicate)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| predicate | function | Test callback. |
Return Value
any
Result of the operation.
Working Example
Example Snippetjavascript
console.log(JSON.stringify(Iterator.from([1,2,3]).find(x=>x>1)));