map = function (a, f) { var result = []; each (a, (e) => result.push(f(e))); return result; } double = (x) => x * 2; map([1,2,3], double);
Output