Standard built-ins

Iterator.prototype.map()

Try the free JavaScript compiler

Lazily transforms each value using a callback receiving value and index.

Formal Syntax & Structure

javascript syntaxjavascript
iterator.map(mapper)

Parameters & Attributes

NameTypeDescription
mapperfunctionMapping callback.

Return Value

Iterator

Result of the operation.

Working Example

Example Snippetjavascript
console.log(JSON.stringify(Iterator.from([1,2]).map(x=>x*3).toArray()));
JavaScript Reference