aboutsummaryrefslogtreecommitdiffstats
path: root/2635/main.js
diff options
context:
space:
mode:
authorterminaldweller <devi@terminaldweller.com>2024-01-03 22:48:38 +0000
committerterminaldweller <devi@terminaldweller.com>2024-01-03 22:48:38 +0000
commit5d36918d7a229b8d987b242ff3fc3c9d4cfe6fbd (patch)
tree321b01b3c83a269678aad3469fd17a8127bc7aa9 /2635/main.js
parent2665 (diff)
downloadleetcode-5d36918d7a229b8d987b242ff3fc3c9d4cfe6fbd.tar.gz
leetcode-5d36918d7a229b8d987b242ff3fc3c9d4cfe6fbd.zip
2635
Diffstat (limited to '')
-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;
+};