We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Exchange two values.
function swap(x, i, j) // x: an iterable // i: an index // j: another index
const xiterable = require('extra-iterable'); var x = [1, 2, 3, 4]; [...xiterable.swap(x, 0, 1)]; // → [2, 1, 3, 4] [...xiterable.swap(x, 0, 3)]; // → [4, 2, 3, 1]