.swap(idx1,idx2)

Description

Swap allows you to swap two items in an array.

Parameters

Swap takes two parameters, the indexes of the items to swap with each other.

Usage On Arrays

log [1,3,2,4].swap(2,3)
// [1,2,3,4]

Last updated