Standard built-ins
Iterator.prototype.filter()
Lazily yields values whose callback result is truthy. Callback receives value and index.
Formal Syntax & Structure
javascript syntaxjavascript
iterator.filter(predicate)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| predicate | function | Selection callback. |
Return Value
Iterator
Result of the operation.
Working Example
Example Snippetjavascript
console.log(JSON.stringify(Iterator.from([1,2,3]).filter(x=>x>1).toArray()));