function makeClosures(arr, fn) { var result = [] for (let i = 0; i < arr.length; i++) { var a = fn(arr[i]) result.push(a) } return result } var abc = makeClosures([1, 2, 3], function (x) { return x * x; }) console.log(abc[1])