Yngvarr

Generation

generate functionThu, 01 Dec 2022

map

var map = function(f, l) { var ret = []; for (var i = 0; i < l.length; i++) { ret.push(f(l[i])); } return ret; } // example map(function(x){return x*x;}, [1, 2, 3, 4, 5])

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant