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
@ -20,9 +20,9 @@ The function <code>raiseToPower</code> raises a base to an exponent. Unfortunate
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should fix the variable <code>power</code> so it equals 2 raised to the 3rd power, not 3 raised to the 2nd power.
|
||||
testString: assert(power == 8, 'Your code should fix the variable <code>power</code> so it equals 2 raised to the 3rd power, not 3 raised to the 2nd power.');
|
||||
testString: assert(power == 8);
|
||||
- text: Your code should use the correct order of the arguments for the <code>raiseToPower</code> function call.
|
||||
testString: assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g), 'Your code should use the correct order of the arguments for the <code>raiseToPower</code> function call.');
|
||||
testString: assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -30,9 +30,9 @@ Fix the code so the variable <code>result</code> is set to the value returned fr
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should fix the variable <code>result</code> so it is set to the number that the function <code>getNine</code> returns.
|
||||
testString: assert(result == 9, 'Your code should fix the variable <code>result</code> so it is set to the number that the function <code>getNine</code> returns.');
|
||||
testString: assert(result == 9);
|
||||
- text: Your code should call the <code>getNine</code> function.
|
||||
testString: assert(code.match(/getNine\(\)/g).length == 2, 'Your code should call the <code>getNine</code> function.');
|
||||
testString: assert(code.match(/getNine\(\)/g).length == 2);
|
||||
|
||||
```
|
||||
|
||||
|
@ -23,13 +23,13 @@ tests:
|
||||
- text: 'Check the spelling of the two variables used in the netWorkingCapital calculation, the console output should show that "Net working capital is: 2".'
|
||||
testString: 'assert(netWorkingCapital === 2, ''Check the spelling of the two variables used in the netWorkingCapital calculation, the console output should show that "Net working capital is: 2".'');'
|
||||
- text: There should be no instances of mis-spelled variables in the code.
|
||||
testString: assert(!code.match(/recievables/g), 'There should be no instances of mis-spelled variables in the code.');
|
||||
testString: assert(!code.match(/recievables/g));
|
||||
- text: The <code>receivables</code> variable should be declared and used properly in the code.
|
||||
testString: assert(code.match(/receivables/g).length == 2, 'The <code>receivables</code> variable should be declared and used properly in the code.');
|
||||
testString: assert(code.match(/receivables/g).length == 2);
|
||||
- text: There should be no instances of mis-spelled variables in the code.
|
||||
testString: assert(!code.match(/payable;/g), 'There should be no instances of mis-spelled variables in the code.');
|
||||
testString: assert(!code.match(/payable;/g));
|
||||
- text: The <code>payables</code> variable should be declared and used properly in the code.
|
||||
testString: assert(code.match(/payables/g).length == 2, 'The <code>payables</code> variable should be declared and used properly in the code.');
|
||||
testString: assert(code.match(/payables/g).length == 2);
|
||||
|
||||
```
|
||||
|
||||
|
@ -38,9 +38,9 @@ Fix the string so it either uses different quotes for the <code>href</code> valu
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should fix the quotes around the <code>href</code> value "#Home" by either changing or escaping them.
|
||||
testString: assert(code.match(/<a href=\s*?('|\\")#Home\1\s*?>/g), 'Your code should fix the quotes around the <code>href</code> value "#Home" by either changing or escaping them.');
|
||||
testString: assert(code.match(/<a href=\s*?('|\\")#Home\1\s*?>/g));
|
||||
- text: Your code should keep the double quotes around the entire string.
|
||||
testString: assert(code.match(/"<p>.*?<\/p>";/g), 'Your code should keep the double quotes around the entire string.');
|
||||
testString: assert(code.match(/"<p>.*?<\/p>";/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -39,13 +39,13 @@ Fix the two indexing errors in the following function so all the numbers 1 throu
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should set the initial condition of the loop so it starts at the first index.
|
||||
testString: assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1, 'Your code should set the initial condition of the loop so it starts at the first index.');
|
||||
testString: assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1);
|
||||
- text: Your code should fix the initial condition of the loop so that the index starts at 0.
|
||||
testString: assert(!code.match(/i\s?=\s*?1\s*?;/g), 'Your code should fix the initial condition of the loop so that the index starts at 0.');
|
||||
testString: assert(!code.match(/i\s?=\s*?1\s*?;/g));
|
||||
- text: Your code should set the terminal condition of the loop so it stops at the last index.
|
||||
testString: assert(code.match(/i\s*?<\s*?len\s*?;/g).length == 1, 'Your code should set the terminal condition of the loop so it stops at the last index.');
|
||||
testString: assert(code.match(/i\s*?<\s*?len\s*?;/g).length == 1);
|
||||
- text: Your code should fix the terminal condition of the loop so that it stops at 1 before the length.
|
||||
testString: assert(!code.match(/i\s*?<=\s*?len;/g), 'Your code should fix the terminal condition of the loop so that it stops at 1 before the length.');
|
||||
testString: assert(!code.match(/i\s*?<=\s*?len;/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -21,7 +21,7 @@ Fix the two pair errors in the code.
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should fix the missing piece of the array.
|
||||
testString: assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g), 'Your code should fix the missing piece of the array.');
|
||||
testString: assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g));
|
||||
- text: 'Your code should fix the missing piece of the <code>.reduce()</code> method. The console output should show that "Sum of array values is: 6".'
|
||||
testString: 'assert(arraySum === 6, ''Your code should fix the missing piece of the <code>.reduce()</code> method. The console output should show that "Sum of array values is: 6".'');'
|
||||
|
||||
|
@ -34,9 +34,9 @@ Fix the condition so the program runs the right branch, and the appropriate valu
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should fix the condition so it checks for equality, instead of using assignment.
|
||||
testString: assert(result == "Not equal!", 'Your code should fix the condition so it checks for equality, instead of using assignment.');
|
||||
testString: assert(result == "Not equal!");
|
||||
- text: The condition can use either <code>==</code> or <code>===</code> to test for equality.
|
||||
testString: assert(code.match(/x\s*?===?\s*?y/g), 'The condition can use either <code>==</code> or <code>===</code> to test for equality.');
|
||||
testString: assert(code.match(/x\s*?===?\s*?y/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -31,9 +31,9 @@ The <code>myFunc()</code> function contains an infinite loop because the termina
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should change the comparison operator in the terminal condition (the middle part) of the <code>for</code> loop.
|
||||
testString: assert(code.match(/i\s*?<=\s*?4;/g).length == 1, 'Your code should change the comparison operator in the terminal condition (the middle part) of the <code>for</code> loop.');
|
||||
testString: assert(code.match(/i\s*?<=\s*?4;/g).length == 1);
|
||||
- text: Your code should fix the comparison operator in the terminal condition of the loop.
|
||||
testString: assert(!code.match(/i\s*?!=\s*?4;/g), 'Your code should fix the comparison operator in the terminal condition of the loop.');
|
||||
testString: assert(!code.match(/i\s*?!=\s*?4;/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -26,11 +26,11 @@ Use <code>console.log()</code> to print the variables in the code where indicate
|
||||
```yml
|
||||
tests:
|
||||
- text: Use <code>console.log()</code> to print the <code>outputTwo</code> variable. In your Browser Console this should print out the value of the variable two times.
|
||||
testString: assert(code.match(/console\.log\(outputTwo\)/g), 'Use <code>console.log()</code> to print the <code>outputTwo</code> variable. In your Browser Console this should print out the value of the variable two times.');
|
||||
testString: assert(code.match(/console\.log\(outputTwo\)/g));
|
||||
- text: Use <code>console.log()</code> to print the <code>outputOne</code> variable.
|
||||
testString: assert(code.match(/console\.log\(outputOne\)/g), 'Use <code>console.log()</code> to print the <code>outputOne</code> variable.');
|
||||
testString: assert(code.match(/console\.log\(outputOne\)/g));
|
||||
- text: Use <code>console.clear()</code> to modify your output so that <code>outputOne</code> variable only outputs once.
|
||||
testString: assert(code.match(/^(\s*console.clear\(\);?\s*)$/gm), 'Use <code>console.clear()</code> to modify your output so that <code>outputOne</code> variable only outputs once.');
|
||||
testString: assert(code.match(/^(\s*console.clear\(\);?\s*)$/gm));
|
||||
|
||||
```
|
||||
|
||||
|
@ -21,11 +21,11 @@ The following function is supposed to create a two-dimensional array with <code>
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should set the <code>matrix</code> variable to an array holding 3 rows of 2 columns of zeroes each.
|
||||
testString: assert(JSON.stringify(matrix) == "[[0,0],[0,0],[0,0]]", 'Your code should set the <code>matrix</code> variable to an array holding 3 rows of 2 columns of zeroes each.');
|
||||
testString: assert(JSON.stringify(matrix) == "[[0,0],[0,0],[0,0]]");
|
||||
- text: The <code>matrix</code> variable should have 3 rows.
|
||||
testString: assert(matrix.length == 3, 'The <code>matrix</code> variable should have 3 rows.');
|
||||
testString: assert(matrix.length == 3);
|
||||
- text: The <code>matrix</code> variable should have 2 columns in each row.
|
||||
testString: assert(matrix[0].length == 2 && matrix[1].length === 2 && matrix[2].length === 2, 'The <code>matrix</code> variable should have 2 columns in each row.');
|
||||
testString: assert(matrix[0].length == 2 && matrix[1].length === 2 && matrix[2].length === 2);
|
||||
|
||||
```
|
||||
|
||||
|
@ -24,7 +24,7 @@ Use the <code>console.log()</code> method to print the value of the variable <co
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use <code>console.log()</code> to check the value of the variable <code>a</code>.
|
||||
testString: assert(code.match(/console\.log\(a\)/g), 'Your code should use <code>console.log()</code> to check the value of the variable <code>a</code>.');
|
||||
testString: assert(code.match(/console\.log\(a\)/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -30,11 +30,11 @@ Add two <code>console.log()</code> statements to check the <code>typeof</code> e
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use <code>typeof</code> in two <code>console.log()</code> statements to check the type of the variables.
|
||||
testString: assert(code.match(/console\.log\(typeof[\( ].*\)?\)/g).length == 2, 'Your code should use <code>typeof</code> in two <code>console.log()</code> statements to check the type of the variables.');
|
||||
testString: assert(code.match(/console\.log\(typeof[\( ].*\)?\)/g).length == 2);
|
||||
- text: Your code should use <code>typeof</code> to check the type of the variable <code>seven</code>.
|
||||
testString: assert(code.match(/typeof[\( ]seven\)?/g), 'Your code should use <code>typeof</code> to check the type of the variable <code>seven</code>.');
|
||||
testString: assert(code.match(/typeof[\( ]seven\)?/g));
|
||||
- text: Your code should use <code>typeof</code> to check the type of the variable <code>three</code>.
|
||||
testString: assert(code.match(/typeof[\( ]three\)?/g), 'Your code should use <code>typeof</code> to check the type of the variable <code>three</code>.');
|
||||
testString: assert(code.match(/typeof[\( ]three\)?/g));
|
||||
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user