fix(curriculum): Remove unnecessary assert message argument from English challenges JavaScript Algorithms and Data Structures - 02 (#36402)
* fix: rm assert msg basic-algorithm-scripting * fix: rm assert msg debugging * fix: rm assert msg es6 * fix: rm assert msg functional-programming
This commit is contained in:
committed by
Oliver Eyton-Williams
parent
c856fe56bd
commit
5bf8527523
@ -83,11 +83,11 @@ This exercise is designed to illustrate the difference between how <code>var</co
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>var</code> should not exist in code.
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/var/g),'<code>var</code> should not exist in code.');
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/var/g));
|
||||
- text: The variable <code>i</code> declared in the if statement should equal "block scope".
|
||||
testString: getUserInput => assert(getUserInput('index').match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g), 'The variable <code>i</code> declared in the if statement should equal "block scope".');
|
||||
testString: getUserInput => assert(getUserInput('index').match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g));
|
||||
- text: <code>checkScope()</code> should return "function scope"
|
||||
testString: assert(checkScope() === "function scope", '<code>checkScope()</code> should return "function scope"');
|
||||
testString: assert(checkScope() === "function scope");
|
||||
|
||||
```
|
||||
|
||||
|
@ -44,14 +44,14 @@ Use an iterator method (any kind of loop) to get the desired output.
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>resultDisplayArray</code> is an array containing <code>result failure</code> messages.
|
||||
testString: assert(typeof makeList(result.failure) === 'object' && resultDisplayArray.length === 3, '<code>resultDisplayArray</code> is a list containing <code>result failure</code> messages.');
|
||||
- text: <code>resultDisplayArray</code> should be an array containing <code>result failure</code> messages.
|
||||
testString: assert(typeof makeList(result.failure) === 'object' && resultDisplayArray.length === 3);
|
||||
- text: <code>resultDisplayArray</code> is the desired output.
|
||||
testString: assert(makeList(result.failure).every((v, i) => v === `<li class="text-warning">${result.failure[i]}</li>` || v === `<li class='text-warning'>${result.failure[i]}</li>`), '<code>resultDisplayArray</code> is the desired output.');
|
||||
testString: assert(makeList(result.failure).every((v, i) => v === `<li class="text-warning">${result.failure[i]}</li>` || v === `<li class='text-warning'>${result.failure[i]}</li>`));
|
||||
- text: Template strings and expression interpolation should be used
|
||||
testString: getUserInput => assert(getUserInput('index').match(/(`.*\${.*}.*`)/), 'Template strings and expression interpolation should be used');
|
||||
testString: getUserInput => assert(getUserInput('index').match(/(`.*\${.*}.*`)/));
|
||||
- text: An iterator should be used
|
||||
testString: getUserInput => assert(getUserInput('index').match(/for|map|reduce|forEach|while/), 'An iterator should be used');
|
||||
testString: getUserInput => assert(getUserInput('index').match(/for|map|reduce|forEach|while/));
|
||||
```
|
||||
|
||||
</section>
|
||||
|
@ -31,13 +31,13 @@ Change the code so that all variables are declared using <code>let</code> or <co
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>var</code> does not exist in your code.
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/var/g),'<code>var</code> does not exist in your code.');
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/var/g));
|
||||
- text: <code>SENTENCE</code> should be a constant variable declared with <code>const</code>.
|
||||
testString: getUserInput => assert(getUserInput('index').match(/(const SENTENCE)/g), '<code>SENTENCE</code> should be a constant variable declared with <code>const</code>.');
|
||||
testString: getUserInput => assert(getUserInput('index').match(/(const SENTENCE)/g));
|
||||
- text: <code>i</code> should be declared with <code>let</code>.
|
||||
testString: getUserInput => assert(getUserInput('index').match(/(let i)/g), '<code>i</code> should be declared with <code>let</code>.');
|
||||
testString: getUserInput => assert(getUserInput('index').match(/(let i)/g));
|
||||
- text: <code>console.log</code> should be changed to print the <code>SENTENCE</code> variable.
|
||||
testString: getUserInput => assert(getUserInput('index').match(/console\.log\(\s*SENTENCE\s*\)\s*;?/g), '<code>console.log</code> should be adjusted to print the variable <code>SENTENCE</code>.');
|
||||
testString: getUserInput => assert(getUserInput('index').match(/console\.log\(\s*SENTENCE\s*\)\s*;?/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -48,11 +48,11 @@ Update the code so it only uses the <code>let</code> keyword.
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>var</code> does not exist in code.
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/var/g),'<code>var</code> does not exist in code.');
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/var/g));
|
||||
- text: <code>catName</code> should be <code>Oliver</code>.
|
||||
testString: assert(catName === "Oliver", '<code>catName</code> should be <code>Oliver</code>.');
|
||||
testString: assert(catName === "Oliver");
|
||||
- text: <code>quote</code> should be <code>"Oliver says Meow!"</code>
|
||||
testString: assert(quote === "Oliver says Meow!", '<code>quote</code> should be <code>"Oliver says Meow!"</code>');
|
||||
testString: assert(quote === "Oliver says Meow!");
|
||||
|
||||
```
|
||||
|
||||
|
@ -32,13 +32,13 @@ An array is declared as <code>const s = [5, 7, 2]</code>. Change the array to <c
|
||||
```yml
|
||||
tests:
|
||||
- text: Do not replace <code>const</code> keyword.
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const/g), 'Do not replace <code>const</code> keyword.');
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const/g));
|
||||
- text: <code>s</code> should be a constant variable (by using <code>const</code>).
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const\s+s/g), '<code>s</code> should be a constant variable (by using <code>const</code>).');
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const\s+s/g));
|
||||
- text: Do not change the original array declaration.
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g), 'Do not change the original array declaration.');
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g));
|
||||
- text: <code>s</code> should be equal to <code>[2, 5, 7]</code>.
|
||||
testString: assert.deepEqual(s, [2, 5, 7], '<code>s</code> should be equal to <code>[2, 5, 7]</code>.');
|
||||
testString: assert.deepEqual(s, [2, 5, 7]);
|
||||
|
||||
```
|
||||
|
||||
|
@ -34,13 +34,13 @@ In this challenge you are going to use <code>Object.freeze</code> to prevent mat
|
||||
```yml
|
||||
tests:
|
||||
- text: Do not replace <code>const</code> keyword.
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const/g), 'Do not replace <code>const</code> keyword.');
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const/g));
|
||||
- text: <code>MATH_CONSTANTS</code> should be a constant variable (by using <code>const</code>).
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const\s+MATH_CONSTANTS/g), '<code>MATH_CONSTANTS</code> should be a constant variable (by using <code>const</code>).');
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const\s+MATH_CONSTANTS/g));
|
||||
- text: Do not change original <code>MATH_CONSTANTS</code>.
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g), 'Do not change original <code>MATH_CONSTANTS</code>.');
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g));
|
||||
- text: <code>PI</code> equals <code>3.14</code>.
|
||||
testString: assert(PI === 3.14, '<code>PI</code> equals <code>3.14</code>.');
|
||||
testString: assert(PI === 3.14);
|
||||
|
||||
```
|
||||
|
||||
|
@ -40,15 +40,15 @@ Rewrite the <code>myConcat</code> function which appends contents of <code>arr2<
|
||||
```yml
|
||||
tests:
|
||||
- text: User did replace <code>var</code> keyword.
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/var/g), 'User did replace <code>var</code> keyword.');
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/var/g));
|
||||
- text: <code>myConcat</code> should be a constant variable (by using <code>const</code>).
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const\s+myConcat/g), '<code>myConcat</code> should be a constant variable (by using <code>const</code>).');
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const\s+myConcat/g));
|
||||
- text: <code>myConcat</code> should be a function
|
||||
testString: assert(typeof myConcat === 'function', '<code>myConcat</code> should be a function');
|
||||
testString: assert(typeof myConcat === 'function');
|
||||
- text: <code>myConcat()</code> returns the correct <code>array</code>
|
||||
testString: assert(() => { const a = myConcat([1], [2]); return a[0] == 1 && a[1] == 2; }, '<code>myConcat()</code> returns the correct <code>array</code>');
|
||||
testString: assert(() => { const a = myConcat([1], [2]); return a[0] == 1 && a[1] == 2; });
|
||||
- text: <code>function</code> keyword was not used.
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/function/g), '<code>function</code> keyword was not used.');
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/function/g));
|
||||
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user