Can map function in JS do multiple transformations at once? [closed]

Solution 1:

If you want to make multiple transformations to an array element at once all you have to do is use parenthesis to separate and have them be done in a certain order.

For your example, you could do it like this:

var array = [1, 2, 3, 4];
array.map(num => (num * 2) / 3);

Which would give you

[0.6666666666666666, 1.3333333333333333, 2, 2.6666666666666665]