feat(learn): add tests to use a callback function in the sort method (#40847)
parent
959fe8323a
commit
0f8449788c
|
@ -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--
|
||||
|
|
Loading…
Reference in New Issue