I think there is a mistake in the 1st code which you have provided which is for map() method. Where you have written code for anonymous fn call in the return statement you are multiplying current element of array with 3 so the output would be [ 3, 6, 9, 12, 15 ].