From 0f8449788ca46b8404b29c4edbc6fa7bebe21c39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismail=20Tlem=C3=A7ani?= <34961373+Ismailtlem@users.noreply.github.com> Date: Wed, 10 Feb 2021 12:35:23 +0100 Subject: [PATCH] feat(learn): add tests to use a callback function in the sort method (#40847) --- ...ed-array-without-changing-the-original-array.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md index 3d77603ca7a..6a042167527 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/return-a-sorted-array-without-changing-the-original-array.md @@ -49,6 +49,20 @@ The function should return a new array, not the array passed to it. assert(nonMutatingSort(globalArray) !== globalArray); ``` +`nonMutatingSort([1, 30, 4, 21, 100000])` should return `[1, 4, 21, 30, 100000]`. + +```js +assert(JSON.stringify(nonMutatingSort([1, 30, 4, 21, 100000])) === + JSON.stringify([1, 4, 21, 30, 100000])) +``` + +`nonMutatingSort([140000, 104, 99])` should return `[99, 104, 140000]`. + +```js +assert(JSON.stringify(nonMutatingSort([140000, 104, 99])) === + JSON.stringify([99, 104, 140000])) +``` + # --seed-- ## --seed-contents--