We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Exchanges two values. 🏃 📼 📦 🌔 📒
Alternatives: swap, swap$.
array.swap(x, i, j); // x: an array // i: an index // j: another index
const array = require("extra-array"); var x = [1, 2, 3, 4]; array.swap(x, 0, 1); // [ 2, 1, 3, 4 ] array.swap(x, 0, 3); // [ 4, 2, 3, 1 ]