dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
912 B
912 B
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 6939b873185d8e00d453563d | Challenge 158: Array Swap | 28 | challenge-158 |
--description--
Given an array with two values, return an array with the values swapped.
For example, given ["A", "B"] return ["B", "A"].
--hints--
arraySwap(["A", "B"]) should return ["B", "A"].
assert.deepEqual(arraySwap(["A", "B"]), ["B", "A"]);
arraySwap([25, 20]) should return [20, 25].
assert.deepEqual(arraySwap([25, 20]), [20, 25]);
arraySwap([true, false]) should return [false, true].
assert.deepEqual(arraySwap([true, false]), [false, true]);
arraySwap(["1", 1]) should return [1, "1"].
assert.deepEqual(arraySwap(["1", 1]), [1, "1"]);
--seed--
--seed-contents--
function arraySwap(arr) {
return arr;
}
--solutions--
function arraySwap(arr) {
return [arr[1], arr[0]];
}