All prompts are owned by LeetCode. To view the prompt, click the title link above.
First completed : July 09, 2024
Last updated : July 09, 2024
Related Topics : N/A
Acceptance Rate : 85.88 %
/**
* @param {number[]} arr
* @param {Function} fn
* @return {number[]}
*/
var map = function(arr, fn) {
console.log(fn);
for (let i = 0; i < arr.length; i++) {
arr[i] = fn(arr[i], i);
}
return arr;
};