Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
Map!
node v0.10.48
version:
1.0.1
endpoint
share
tweet
var map = module.exports.map = function(input, fn) { var output = []; for (var i = 0; i < input.length; i++) { output[i] = fn(input[i]) } return output }
You know the drill.
map([1, 2, 3], function(n){ return n * 10; })
Loading…
no comments
sign in
to comment