leetcode 30 days js challenge
Easy
2635. Apply Transform Over Each Element in Array
Given an integer array arr
and a mapping function fn
, return a new array with a transformation applied to each element.
The returned array should be created such that returnedArray[i] = fn(arr[i], i)
.
Please solve it without the built-in Array.map
method.
Example 1:
Example 2:
Example 3:
Constraints:
0 <= arr.length <= 1000
arr[i]
<= 109fn returns a number
SheepMon, May 8, 2023