I would like to find out if swapping elements can be done using only .reduce
in JavaScript. If not, what else should be used from the functional programming land?
This is not for sorting an array. I wanted to find all the permutations of the array element using .reduce
which required the swap step as per this method.