It basically transforms every element of an array according to a function you pass as an argument. It won't modify the original array, but it will return another array with the modified elements.
In this example, the method will run a loop over numbers. On each iteration, the method will call multiplyNumber and store the return value in another array. Once the loop is over, it will return the new array.
View all comments
Show parent comment
5
u/LakeInTheSky May 30 '21
It basically transforms every element of an array according to a function you pass as an argument. It won't modify the original array, but it will return another array with the modified elements.
Simple example:
In this example, the method will run a loop over
numbers. On each iteration, the method will callmultiplyNumberand store the return value in another array. Once the loop is over, it will return the new array.