Atom

Callbacks

A callback is a function you pass to other code so that code can call it later. A collection operation can use a callback to decide how to transform each item.

Transform every item

Pass double without parentheses, so collection.map receives the function itself.

Atom
use collection

func double(value):
    return value * 2

scores = collection.map([2, 3], double)
print(scores[0], scores[1])
Output
4 6

collection.map calls double once for each input and collects its return values.