SHIFT + D

swap

Updated on August 22, 2024Source codeTests

createSwap is a pipe that transforms an array to an array with the positions of two items swapped.

Create swap

Call createSwap with these parameters to create your swap function:

Parameter
Type
Required
Description
item1Index
number
yes
The index of the first item to swap.
item2Index
number
yes
The index of the second item to swap.

sorttry async

Edit doc on GitHub

ON THIS PAGE

swapCreate swap