aboutsummaryrefslogtreecommitdiffstats
path: root/2635
diff options
context:
space:
mode:
Diffstat (limited to '2635')
-rwxr-xr-x2635/main.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/2635/main.js b/2635/main.js
new file mode 100755
index 0000000..decd7d9
--- /dev/null
+++ b/2635/main.js
@@ -0,0 +1,17 @@
+#!/usr/bin/env node
+"use strict";
+
+/**
+ * * @param {number[]} arr
+ * * @param {Function} fn
+ * * @return {number[]}
+ * */
+var map = function (arr, fn) {
+ var resArr = new Array();
+ var i = 0;
+ arr.forEach((element) => {
+ resArr.push(fn(element, i));
+ i++;
+ });
+ return resArr;
+};