fix(curriculum): ensure algorithm does not include the Array method `… (#38520)

* fix(curriculum): replace comments with empty strings in merge-sort challenge

* Update curriculum/challenges/english/08-coding-interview-prep/algorithms/implement-merge-sort.english.md

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
Ashraf Nazar
2020-04-27 13:28:37 +01:00
committed by GitHub
parent 8399dd543a
commit 46e0748af3

View File

@ -33,7 +33,7 @@ tests:
- text: <code>mergeSort</code> should return an array that is unchanged except for order.
testString: assert.sameMembers(mergeSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]), [1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]);
- text: <code>mergeSort</code> should not use the built-in <code>.sort()</code> method.
testString: assert(!code.match(/\.?[\s\S]*?sort/));
testString: assert(!removeJSComments(code).match(/\.?[\s\S]*?sort\s*\(/));
```
@ -62,6 +62,8 @@ mergeSort([1, 4, 2, 8, 345, 123, 43, 32, 5643, 63, 123, 43, 2, 55, 1, 234, 92]);
<div id='js-teardown'>
```js
const removeJSComments = str => str.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '');
function isSorted(arr) {
var check = (i) => (i == arr.length - 1) ? true : (arr[i] > arr[i + 1]) ? false : check(i + 1);
return check(0);