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
@ -23,25 +23,25 @@ Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-yo
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>booWho(true)</code> should return true.
|
||||
testString: assert.strictEqual(booWho(true), true, '<code>booWho(true)</code> should return true.');
|
||||
testString: assert.strictEqual(booWho(true), true);
|
||||
- text: <code>booWho(false)</code> should return true.
|
||||
testString: assert.strictEqual(booWho(false), true, '<code>booWho(false)</code> should return true.');
|
||||
testString: assert.strictEqual(booWho(false), true);
|
||||
- text: <code>booWho([1, 2, 3])</code> should return false.
|
||||
testString: assert.strictEqual(booWho([1, 2, 3]), false, '<code>booWho([1, 2, 3])</code> should return false.');
|
||||
testString: assert.strictEqual(booWho([1, 2, 3]), false);
|
||||
- text: <code>booWho([].slice)</code> should return false.
|
||||
testString: assert.strictEqual(booWho([].slice), false, '<code>booWho([].slice)</code> should return false.');
|
||||
testString: assert.strictEqual(booWho([].slice), false);
|
||||
- text: '<code>booWho({ "a": 1 })</code> should return false.'
|
||||
testString: 'assert.strictEqual(booWho({ "a": 1 }), false, ''<code>booWho({ "a": 1 })</code> should return false.'');'
|
||||
- text: <code>booWho(1)</code> should return false.
|
||||
testString: assert.strictEqual(booWho(1), false, '<code>booWho(1)</code> should return false.');
|
||||
testString: assert.strictEqual(booWho(1), false);
|
||||
- text: <code>booWho(NaN)</code> should return false.
|
||||
testString: assert.strictEqual(booWho(NaN), false, '<code>booWho(NaN)</code> should return false.');
|
||||
testString: assert.strictEqual(booWho(NaN), false);
|
||||
- text: <code>booWho("a")</code> should return false.
|
||||
testString: assert.strictEqual(booWho("a"), false, '<code>booWho("a")</code> should return false.');
|
||||
testString: assert.strictEqual(booWho("a"), false);
|
||||
- text: <code>booWho("true")</code> should return false.
|
||||
testString: assert.strictEqual(booWho("true"), false, '<code>booWho("true")</code> should return false.');
|
||||
testString: assert.strictEqual(booWho("true"), false);
|
||||
- text: <code>booWho("false")</code> should return false.
|
||||
testString: assert.strictEqual(booWho("false"), false, '<code>booWho("false")</code> should return false.');
|
||||
testString: assert.strictEqual(booWho("false"), false);
|
||||
|
||||
```
|
||||
|
||||
|
@ -22,19 +22,19 @@ Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>chunkArrayInGroups(["a", "b", "c", "d"], 2)</code> should return <code>[["a", "b"], ["c", "d"]]</code>.
|
||||
testString: assert.deepEqual(chunkArrayInGroups(["a", "b", "c", "d"], 2), [["a", "b"], ["c", "d"]], '<code>chunkArrayInGroups(["a", "b", "c", "d"], 2)</code> should return <code>[["a", "b"], ["c", "d"]]</code>.');
|
||||
testString: assert.deepEqual(chunkArrayInGroups(["a", "b", "c", "d"], 2), [["a", "b"], ["c", "d"]]);
|
||||
- text: <code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3)</code> should return <code>[[0, 1, 2], [3, 4, 5]]</code>.
|
||||
testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3)</code> should return <code>[[0, 1, 2], [3, 4, 5]]</code>.');
|
||||
testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]]);
|
||||
- text: <code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2)</code> should return <code>[[0, 1], [2, 3], [4, 5]]</code>.
|
||||
testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]], '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2)</code> should return <code>[[0, 1], [2, 3], [4, 5]]</code>.');
|
||||
testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]]);
|
||||
- text: <code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4)</code> should return <code>[[0, 1, 2, 3], [4, 5]]</code>.
|
||||
testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4)</code> should return <code>[[0, 1, 2, 3], [4, 5]]</code>.');
|
||||
testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]]);
|
||||
- text: <code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3)</code> should return <code>[[0, 1, 2], [3, 4, 5], [6]]</code>.
|
||||
testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3), [[0, 1, 2], [3, 4, 5], [6]], '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3)</code> should return <code>[[0, 1, 2], [3, 4, 5], [6]]</code>.');
|
||||
testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3), [[0, 1, 2], [3, 4, 5], [6]]);
|
||||
- text: <code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4)</code> should return <code>[[0, 1, 2, 3], [4, 5, 6, 7], [8]]</code>.
|
||||
testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4), [[0, 1, 2, 3], [4, 5, 6, 7], [8]], '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4)</code> should return <code>[[0, 1, 2, 3], [4, 5, 6, 7], [8]]</code>.');
|
||||
testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4), [[0, 1, 2, 3], [4, 5, 6, 7], [8]]);
|
||||
- text: <code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2)</code> should return <code>[[0, 1], [2, 3], [4, 5], [6, 7], [8]]</code>.
|
||||
testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2), [[0, 1], [2, 3], [4, 5], [6, 7], [8]], '<code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2)</code> should return <code>[[0, 1], [2, 3], [4, 5], [6, 7], [8]]</code>.');
|
||||
testString: assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2), [[0, 1], [2, 3], [4, 5], [6, 7], [8]]);
|
||||
|
||||
```
|
||||
|
||||
|
@ -23,27 +23,27 @@ Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>confirmEnding("Bastian", "n")</code> should return true.
|
||||
testString: assert(confirmEnding("Bastian", "n") === true, '<code>confirmEnding("Bastian", "n")</code> should return true.');
|
||||
testString: assert(confirmEnding("Bastian", "n") === true);
|
||||
- text: <code>confirmEnding("Congratulation", "on")</code> should return true.
|
||||
testString: assert(confirmEnding("Congratulation", "on") === true, '<code>confirmEnding("Congratulation", "on")</code> should return true.');
|
||||
testString: assert(confirmEnding("Congratulation", "on") === true);
|
||||
- text: <code>confirmEnding("Connor", "n")</code> should return false.
|
||||
testString: assert(confirmEnding("Connor", "n") === false, '<code>confirmEnding("Connor", "n")</code> should return false.');
|
||||
testString: assert(confirmEnding("Connor", "n") === false);
|
||||
- text: <code>confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification")</code> should return false.
|
||||
testString: assert(confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification") === false, '<code>confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification")</code> should return false.');
|
||||
testString: assert(confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification") === false);
|
||||
- text: <code>confirmEnding("He has to give me a new name", "name")</code> should return true.
|
||||
testString: assert(confirmEnding("He has to give me a new name", "name") === true, '<code>confirmEnding("He has to give me a new name", "name")</code> should return true.');
|
||||
testString: assert(confirmEnding("He has to give me a new name", "name") === true);
|
||||
- text: <code>confirmEnding("Open sesame", "same")</code> should return true.
|
||||
testString: assert(confirmEnding("Open sesame", "same") === true, '<code>confirmEnding("Open sesame", "same")</code> should return true.');
|
||||
testString: assert(confirmEnding("Open sesame", "same") === true);
|
||||
- text: <code>confirmEnding("Open sesame", "pen")</code> should return false.
|
||||
testString: assert(confirmEnding("Open sesame", "pen") === false, '<code>confirmEnding("Open sesame", "pen")</code> should return false.');
|
||||
testString: assert(confirmEnding("Open sesame", "pen") === false);
|
||||
- text: <code>confirmEnding("Open sesame", "game")</code> should return false.
|
||||
testString: assert(confirmEnding("Open sesame", "game") === false, '<code>confirmEnding("Open sesame", "game")</code> should return false.');
|
||||
testString: assert(confirmEnding("Open sesame", "game") === false);
|
||||
- text: <code>confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain")</code> should return false.
|
||||
testString: assert(confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain") === false, '<code>confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain")</code> should return false.');
|
||||
testString: assert(confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain") === false);
|
||||
- text: <code>confirmEnding("Abstraction", "action")</code> should return true.
|
||||
testString: assert(confirmEnding("Abstraction", "action") === true, '<code>confirmEnding("Abstraction", "action")</code> should return true.');
|
||||
testString: assert(confirmEnding("Abstraction", "action") === true);
|
||||
- text: Do not use the built-in method <code>.endsWith()</code> to solve the challenge.
|
||||
testString: assert(!(/\.endsWith\(.*?\)\s*?;?/.test(code)) && !(/\['endsWith'\]/.test(code)), 'Do not use the built-in method <code>.endsWith()</code> to solve the challenge.');
|
||||
testString: assert(!(/\.endsWith\(.*?\)\s*?;?/.test(code)) && !(/\['endsWith'\]/.test(code)));
|
||||
|
||||
```
|
||||
|
||||
|
@ -23,17 +23,17 @@ Don't worry too much about the function and return statements as they will be co
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>convertToF(0)</code> should return a number
|
||||
testString: assert(typeof convertToF(0) === 'number', '<code>convertToF(0)</code> should return a number');
|
||||
testString: assert(typeof convertToF(0) === 'number');
|
||||
- text: <code>convertToF(-30)</code> should return a value of <code>-22</code>
|
||||
testString: assert(convertToF(-30) === -22, '<code>convertToF(-30)</code> should return a value of <code>-22</code>');
|
||||
testString: assert(convertToF(-30) === -22);
|
||||
- text: <code>convertToF(-10)</code> should return a value of <code>14</code>
|
||||
testString: assert(convertToF(-10) === 14, '<code>convertToF(-10)</code> should return a value of <code>14</code>');
|
||||
testString: assert(convertToF(-10) === 14);
|
||||
- text: <code>convertToF(0)</code> should return a value of <code>32</code>
|
||||
testString: assert(convertToF(0) === 32, '<code>convertToF(0)</code> should return a value of <code>32</code>');
|
||||
testString: assert(convertToF(0) === 32);
|
||||
- text: <code>convertToF(20)</code> should return a value of <code>68</code>
|
||||
testString: assert(convertToF(20) === 68, '<code>convertToF(20)</code> should return a value of <code>68</code>');
|
||||
testString: assert(convertToF(20) === 68);
|
||||
- text: <code>convertToF(30)</code> should return a value of <code>86</code>
|
||||
testString: assert(convertToF(30) === 86, '<code>convertToF(30)</code> should return a value of <code>86</code>');
|
||||
testString: assert(convertToF(30) === 86);
|
||||
|
||||
```
|
||||
|
||||
|
@ -26,15 +26,15 @@ Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>factorialize(5)</code> should return a number.
|
||||
testString: assert(typeof factorialize(5) === 'number', '<code>factorialize(5)</code> should return a number.');
|
||||
testString: assert(typeof factorialize(5) === 'number');
|
||||
- text: <code>factorialize(5)</code> should return 120.
|
||||
testString: assert(factorialize(5) === 120, '<code>factorialize(5)</code> should return 120.');
|
||||
testString: assert(factorialize(5) === 120);
|
||||
- text: <code>factorialize(10)</code> should return 3628800.
|
||||
testString: assert(factorialize(10) === 3628800, '<code>factorialize(10)</code> should return 3628800.');
|
||||
testString: assert(factorialize(10) === 3628800);
|
||||
- text: <code>factorialize(20)</code> should return 2432902008176640000.
|
||||
testString: assert(factorialize(20) === 2432902008176640000, '<code>factorialize(20)</code> should return 2432902008176640000.');
|
||||
testString: assert(factorialize(20) === 2432902008176640000);
|
||||
- text: <code>factorialize(0)</code> should return 1.
|
||||
testString: assert(factorialize(0) === 1, '<code>factorialize(0)</code> should return 1.');
|
||||
testString: assert(factorialize(0) === 1);
|
||||
|
||||
```
|
||||
|
||||
|
@ -24,13 +24,13 @@ Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>bouncer([7, "ate", "", false, 9])</code> should return <code>[7, "ate", 9]</code>.
|
||||
testString: assert.deepEqual(bouncer([7, "ate", "", false, 9]), [7, "ate", 9], '<code>bouncer([7, "ate", "", false, 9])</code> should return <code>[7, "ate", 9]</code>.');
|
||||
testString: assert.deepEqual(bouncer([7, "ate", "", false, 9]), [7, "ate", 9]);
|
||||
- text: <code>bouncer(["a", "b", "c"])</code> should return <code>["a", "b", "c"]</code>.
|
||||
testString: assert.deepEqual(bouncer(["a", "b", "c"]), ["a", "b", "c"], '<code>bouncer(["a", "b", "c"])</code> should return <code>["a", "b", "c"]</code>.');
|
||||
testString: assert.deepEqual(bouncer(["a", "b", "c"]), ["a", "b", "c"]);
|
||||
- text: <code>bouncer([false, null, 0, NaN, undefined, ""])</code> should return <code>[]</code>.
|
||||
testString: assert.deepEqual(bouncer([false, null, 0, NaN, undefined, ""]), [], '<code>bouncer([false, null, 0, NaN, undefined, ""])</code> should return <code>[]</code>.');
|
||||
testString: assert.deepEqual(bouncer([false, null, 0, NaN, undefined, ""]), []);
|
||||
- text: <code>bouncer([1, null, NaN, 2, undefined])</code> should return <code>[1, 2]</code>.
|
||||
testString: assert.deepEqual(bouncer([1, null, NaN, 2, undefined]), [1, 2], '<code>bouncer([1, null, NaN, 2, undefined])</code> should return <code>[1, 2]</code>.');
|
||||
testString: assert.deepEqual(bouncer([1, null, NaN, 2, undefined]), [1, 2]);
|
||||
|
||||
```
|
||||
|
||||
|
@ -23,17 +23,17 @@ Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>findLongestWordLength("The quick brown fox jumped over the lazy dog")</code> should return a number.
|
||||
testString: assert(typeof findLongestWordLength("The quick brown fox jumped over the lazy dog") === "number", '<code>findLongestWordLength("The quick brown fox jumped over the lazy dog")</code> should return a number.');
|
||||
testString: assert(typeof findLongestWordLength("The quick brown fox jumped over the lazy dog") === "number");
|
||||
- text: <code>findLongestWordLength("The quick brown fox jumped over the lazy dog")</code> should return 6.
|
||||
testString: assert(findLongestWordLength("The quick brown fox jumped over the lazy dog") === 6, '<code>findLongestWordLength("The quick brown fox jumped over the lazy dog")</code> should return 6.');
|
||||
testString: assert(findLongestWordLength("The quick brown fox jumped over the lazy dog") === 6);
|
||||
- text: <code>findLongestWordLength("May the force be with you")</code> should return 5.
|
||||
testString: assert(findLongestWordLength("May the force be with you") === 5, '<code>findLongestWordLength("May the force be with you")</code> should return 5.');
|
||||
testString: assert(findLongestWordLength("May the force be with you") === 5);
|
||||
- text: <code>findLongestWordLength("Google do a barrel roll")</code> should return 6.
|
||||
testString: assert(findLongestWordLength("Google do a barrel roll") === 6, '<code>findLongestWordLength("Google do a barrel roll")</code> should return 6.');
|
||||
testString: assert(findLongestWordLength("Google do a barrel roll") === 6);
|
||||
- text: <code>findLongestWordLength("What is the average airspeed velocity of an unladen swallow")</code> should return 8.
|
||||
testString: assert(findLongestWordLength("What is the average airspeed velocity of an unladen swallow") === 8, '<code>findLongestWordLength("What is the average airspeed velocity of an unladen swallow")</code> should return 8.');
|
||||
testString: assert(findLongestWordLength("What is the average airspeed velocity of an unladen swallow") === 8);
|
||||
- text: <code>findLongestWordLength("What if we try a super-long word such as otorhinolaryngology")</code> should return 19.
|
||||
testString: assert(findLongestWordLength("What if we try a super-long word such as otorhinolaryngology") === 19, '<code>findLongestWordLength("What if we try a super-long word such as otorhinolaryngology")</code> should return 19.');
|
||||
testString: assert(findLongestWordLength("What if we try a super-long word such as otorhinolaryngology") === 19);
|
||||
|
||||
```
|
||||
|
||||
|
@ -22,9 +22,9 @@ Remember to use <a href='http://forum.freecodecamp.org/t/how-to-get-help-when-yo
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; })</code> should return 8.
|
||||
testString: assert.strictEqual(findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; }), 8, '<code>findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; })</code> should return 8.');
|
||||
testString: assert.strictEqual(findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; }), 8);
|
||||
- text: <code>findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; })</code> should return undefined.
|
||||
testString: assert.strictEqual(findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; }), undefined, '<code>findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; })</code> should return undefined.');
|
||||
testString: assert.strictEqual(findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; }), undefined);
|
||||
|
||||
```
|
||||
|
||||
|
@ -25,23 +25,23 @@ Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>mutation(["hello", "hey"])</code> should return false.
|
||||
testString: assert(mutation(["hello", "hey"]) === false, '<code>mutation(["hello", "hey"])</code> should return false.');
|
||||
testString: assert(mutation(["hello", "hey"]) === false);
|
||||
- text: <code>mutation(["hello", "Hello"])</code> should return true.
|
||||
testString: assert(mutation(["hello", "Hello"]) === true, '<code>mutation(["hello", "Hello"])</code> should return true.');
|
||||
testString: assert(mutation(["hello", "Hello"]) === true);
|
||||
- text: <code>mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])</code> should return true.
|
||||
testString: assert(mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]) === true, '<code>mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])</code> should return true.');
|
||||
testString: assert(mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]) === true);
|
||||
- text: <code>mutation(["Mary", "Army"])</code> should return true.
|
||||
testString: assert(mutation(["Mary", "Army"]) === true, '<code>mutation(["Mary", "Army"])</code> should return true.');
|
||||
testString: assert(mutation(["Mary", "Army"]) === true);
|
||||
- text: <code>mutation(["Mary", "Aarmy"])</code> should return true.
|
||||
testString: assert(mutation(["Mary", "Aarmy"]) === true, '<code>mutation(["Mary", "Aarmy"])</code> should return true.');
|
||||
testString: assert(mutation(["Mary", "Aarmy"]) === true);
|
||||
- text: <code>mutation(["Alien", "line"])</code> should return true.
|
||||
testString: assert(mutation(["Alien", "line"]) === true, '<code>mutation(["Alien", "line"])</code> should return true.');
|
||||
testString: assert(mutation(["Alien", "line"]) === true);
|
||||
- text: <code>mutation(["floor", "for"])</code> should return true.
|
||||
testString: assert(mutation(["floor", "for"]) === true, '<code>mutation(["floor", "for"])</code> should return true.');
|
||||
testString: assert(mutation(["floor", "for"]) === true);
|
||||
- text: <code>mutation(["hello", "neo"])</code> should return false.
|
||||
testString: assert(mutation(["hello", "neo"]) === false, '<code>mutation(["hello", "neo"])</code> should return false.');
|
||||
testString: assert(mutation(["hello", "neo"]) === false);
|
||||
- text: <code>mutation(["voodoo", "no"])</code> should return false.
|
||||
testString: assert(mutation(["voodoo", "no"]) === false, '<code>mutation(["voodoo", "no"])</code> should return false.');
|
||||
testString: assert(mutation(["voodoo", "no"]) === false);
|
||||
|
||||
```
|
||||
|
||||
|
@ -23,13 +23,13 @@ Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> should return an array.
|
||||
testString: assert(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]).constructor === Array, '<code>largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> should return an array.');
|
||||
testString: assert(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]).constructor === Array);
|
||||
- text: <code>largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> should return <code>[27, 5, 39, 1001]</code>.
|
||||
testString: assert.deepEqual(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]), [27, 5, 39, 1001], '<code>largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> should return <code>[27, 5, 39, 1001]</code>.');
|
||||
testString: assert.deepEqual(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]), [27, 5, 39, 1001]);
|
||||
- text: <code>largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])</code> should return <code>[9, 35, 97, 1000000]</code>.
|
||||
testString: assert.deepEqual(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]), [9, 35, 97, 1000000], '<code>largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])</code> should return <code>[9, 35, 97, 1000000]</code>.');
|
||||
testString: assert.deepEqual(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]), [9, 35, 97, 1000000]);
|
||||
- text: <code>largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]])</code> should return <code>[25, 48, 21, -3]</code>.
|
||||
testString: assert.deepEqual(largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]]), [25, 48, 21, -3], '<code>largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]])</code> should return <code>[25, 48, 21, -3]</code>.');
|
||||
testString: assert.deepEqual(largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]]), [25, 48, 21, -3]);
|
||||
|
||||
```
|
||||
|
||||
|
@ -24,13 +24,13 @@ Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>reverseString("hello")</code> should return a string.
|
||||
testString: assert(typeof reverseString("hello") === "string", '<code>reverseString("hello")</code> should return a string.');
|
||||
testString: assert(typeof reverseString("hello") === "string");
|
||||
- text: <code>reverseString("hello")</code> should become <code>"olleh"</code>.
|
||||
testString: assert(reverseString("hello") === "olleh", '<code>reverseString("hello")</code> should become <code>"olleh"</code>.');
|
||||
testString: assert(reverseString("hello") === "olleh");
|
||||
- text: <code>reverseString("Howdy")</code> should become <code>"ydwoH"</code>.
|
||||
testString: assert(reverseString("Howdy") === "ydwoH", '<code>reverseString("Howdy")</code> should become <code>"ydwoH"</code>.');
|
||||
testString: assert(reverseString("Howdy") === "ydwoH");
|
||||
- text: <code>reverseString("Greetings from Earth")</code> should return <code>"htraE morf sgniteerG"</code>.
|
||||
testString: assert(reverseString("Greetings from Earth") === "htraE morf sgniteerG", '<code>reverseString("Greetings from Earth")</code> should return <code>"htraE morf sgniteerG"</code>.');
|
||||
testString: assert(reverseString("Greetings from Earth") === "htraE morf sgniteerG");
|
||||
|
||||
```
|
||||
|
||||
|
@ -26,17 +26,17 @@ Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>frankenSplice([1, 2, 3], [4, 5], 1)</code> should return <code>[4, 1, 2, 3, 5]</code>.
|
||||
testString: assert.deepEqual(frankenSplice([1, 2, 3], [4, 5], 1), [4, 1, 2, 3, 5], '<code>frankenSplice([1, 2, 3], [4, 5], 1)</code> should return <code>[4, 1, 2, 3, 5]</code>.');
|
||||
testString: assert.deepEqual(frankenSplice([1, 2, 3], [4, 5], 1), [4, 1, 2, 3, 5]);
|
||||
- text: <code>frankenSplice([1, 2], ["a", "b"], 1)</code> should return <code>["a", 1, 2, "b"]</code>.
|
||||
testString: assert.deepEqual(frankenSplice(testArr1, testArr2, 1), ["a", 1, 2, "b"], '<code>frankenSplice([1, 2], ["a", "b"], 1)</code> should return <code>["a", 1, 2, "b"]</code>.');
|
||||
testString: assert.deepEqual(frankenSplice(testArr1, testArr2, 1), ["a", 1, 2, "b"]);
|
||||
- text: <code>frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2)</code> should return <code>["head", "shoulders", "claw", "tentacle", "knees", "toes"]</code>.
|
||||
testString: assert.deepEqual(frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2), ["head", "shoulders", "claw", "tentacle", "knees", "toes"], '<code>frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2)</code> should return <code>["head", "shoulders", "claw", "tentacle", "knees", "toes"]</code>.');
|
||||
testString: assert.deepEqual(frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2), ["head", "shoulders", "claw", "tentacle", "knees", "toes"]);
|
||||
- text: All elements from the first array should be added to the second array in their original order.
|
||||
testString: assert.deepEqual(frankenSplice([1, 2, 3, 4], [], 0), [1, 2, 3, 4], 'All elements from the first array should be added to the second array in their original order.');
|
||||
testString: assert.deepEqual(frankenSplice([1, 2, 3, 4], [], 0), [1, 2, 3, 4]);
|
||||
- text: The first array should remain the same after the function runs.
|
||||
testString: assert(testArr1[0] === 1 && testArr1[1] === 2, 'The first array should remain the same after the function runs.');
|
||||
testString: assert(testArr1[0] === 1 && testArr1[1] === 2);
|
||||
- text: The second array should remain the same after the function runs.
|
||||
testString: assert(testArr2[0] === "a" && testArr2[1] === "b", 'The second array should remain the same after the function runs.');
|
||||
testString: assert(testArr2[0] === "a" && testArr2[1] === "b");
|
||||
|
||||
```
|
||||
|
||||
|
@ -23,13 +23,13 @@ Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>titleCase("I'm a little tea pot")</code> should return a string.
|
||||
testString: assert(typeof titleCase("I'm a little tea pot") === "string", '<code>titleCase("I'm a little tea pot")</code> should return a string.');
|
||||
testString: assert(typeof titleCase("I'm a little tea pot") === "string");
|
||||
- text: <code>titleCase("I'm a little tea pot")</code> should return <code>I'm A Little Tea Pot</code>.
|
||||
testString: assert(titleCase("I'm a little tea pot") === "I'm A Little Tea Pot", '<code>titleCase("I'm a little tea pot")</code> should return <code>I'm A Little Tea Pot</code>.');
|
||||
testString: assert(titleCase("I'm a little tea pot") === "I'm A Little Tea Pot");
|
||||
- text: <code>titleCase("sHoRt AnD sToUt")</code> should return <code>Short And Stout</code>.
|
||||
testString: assert(titleCase("sHoRt AnD sToUt") === "Short And Stout", '<code>titleCase("sHoRt AnD sToUt")</code> should return <code>Short And Stout</code>.');
|
||||
testString: assert(titleCase("sHoRt AnD sToUt") === "Short And Stout");
|
||||
- text: <code>titleCase("HERE IS MY HANDLE HERE IS MY SPOUT")</code> should return <code>Here Is My Handle Here Is My Spout</code>.
|
||||
testString: assert(titleCase("HERE IS MY HANDLE HERE IS MY SPOUT") === "Here Is My Handle Here Is My Spout", '<code>titleCase("HERE IS MY HANDLE HERE IS MY SPOUT")</code> should return <code>Here Is My Handle Here Is My Spout</code>.');
|
||||
testString: assert(titleCase("HERE IS MY HANDLE HERE IS MY SPOUT") === "Here Is My Handle Here Is My Spout");
|
||||
|
||||
```
|
||||
|
||||
|
@ -22,17 +22,17 @@ Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>truncateString("A-tisket a-tasket A green and yellow basket", 8)</code> should return "A-tisket...".
|
||||
testString: assert(truncateString("A-tisket a-tasket A green and yellow basket", 8) === "A-tisket...", '<code>truncateString("A-tisket a-tasket A green and yellow basket", 8)</code> should return "A-tisket...".');
|
||||
testString: assert(truncateString("A-tisket a-tasket A green and yellow basket", 8) === "A-tisket...");
|
||||
- text: <code>truncateString("Peter Piper picked a peck of pickled peppers", 11)</code> should return "Peter Piper...".
|
||||
testString: assert(truncateString("Peter Piper picked a peck of pickled peppers", 11) === "Peter Piper...", '<code>truncateString("Peter Piper picked a peck of pickled peppers", 11)</code> should return "Peter Piper...".');
|
||||
testString: assert(truncateString("Peter Piper picked a peck of pickled peppers", 11) === "Peter Piper...");
|
||||
- text: <code>truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length)</code> should return "A-tisket a-tasket A green and yellow basket".
|
||||
testString: assert(truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length) === "A-tisket a-tasket A green and yellow basket", '<code>truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length)</code> should return "A-tisket a-tasket A green and yellow basket".');
|
||||
testString: assert(truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length) === "A-tisket a-tasket A green and yellow basket");
|
||||
- text: <code>truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2)</code> should return "A-tisket a-tasket A green and yellow basket".
|
||||
testString: assert(truncateString('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2) === 'A-tisket a-tasket A green and yellow basket', '<code>truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2)</code> should return "A-tisket a-tasket A green and yellow basket".');
|
||||
testString: assert(truncateString('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2) === 'A-tisket a-tasket A green and yellow basket');
|
||||
- text: <code>truncateString("A-", 1)</code> should return "A...".
|
||||
testString: assert(truncateString("A-", 1) === "A...", '<code>truncateString("A-", 1)</code> should return "A...".');
|
||||
testString: assert(truncateString("A-", 1) === "A...");
|
||||
- text: <code>truncateString("Absolutely Longer", 2)</code> should return "Ab...".
|
||||
testString: assert(truncateString("Absolutely Longer", 2) === "Ab...", '<code>truncateString("Absolutely Longer", 2)</code> should return "Ab...".');
|
||||
testString: assert(truncateString("Absolutely Longer", 2) === "Ab...");
|
||||
|
||||
```
|
||||
|
||||
|
@ -24,37 +24,37 @@ Remember to use <a href="http://forum.freecodecamp.org/t/how-to-get-help-when-yo
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> should return <code>3</code>.
|
||||
testString: assert(getIndexToIns([10, 20, 30, 40, 50], 35) === 3, '<code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> should return <code>3</code>.');
|
||||
testString: assert(getIndexToIns([10, 20, 30, 40, 50], 35) === 3);
|
||||
- text: <code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> should return a number.
|
||||
testString: assert(typeof(getIndexToIns([10, 20, 30, 40, 50], 35)) === "number", '<code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> should return a number.');
|
||||
testString: assert(typeof(getIndexToIns([10, 20, 30, 40, 50], 35)) === "number");
|
||||
- text: <code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> should return <code>2</code>.
|
||||
testString: assert(getIndexToIns([10, 20, 30, 40, 50], 30) === 2, '<code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> should return <code>2</code>.');
|
||||
testString: assert(getIndexToIns([10, 20, 30, 40, 50], 30) === 2);
|
||||
- text: <code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> should return a number.
|
||||
testString: assert(typeof(getIndexToIns([10, 20, 30, 40, 50], 30)) === "number", '<code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> should return a number.');
|
||||
testString: assert(typeof(getIndexToIns([10, 20, 30, 40, 50], 30)) === "number");
|
||||
- text: <code>getIndexToIns([40, 60], 50)</code> should return <code>1</code>.
|
||||
testString: assert(getIndexToIns([40, 60], 50) === 1, '<code>getIndexToIns([40, 60], 50)</code> should return <code>1</code>.');
|
||||
testString: assert(getIndexToIns([40, 60], 50) === 1);
|
||||
- text: <code>getIndexToIns([40, 60], 50)</code> should return a number.
|
||||
testString: assert(typeof(getIndexToIns([40, 60], 50)) === "number", '<code>getIndexToIns([40, 60], 50)</code> should return a number.');
|
||||
testString: assert(typeof(getIndexToIns([40, 60], 50)) === "number");
|
||||
- text: <code>getIndexToIns([3, 10, 5], 3)</code> should return <code>0</code>.
|
||||
testString: assert(getIndexToIns([3, 10, 5], 3) === 0, '<code>getIndexToIns([3, 10, 5], 3)</code> should return <code>0</code>.');
|
||||
testString: assert(getIndexToIns([3, 10, 5], 3) === 0);
|
||||
- text: <code>getIndexToIns([3, 10, 5], 3)</code> should return a number.
|
||||
testString: assert(typeof(getIndexToIns([3, 10, 5], 3)) === "number", '<code>getIndexToIns([3, 10, 5], 3)</code> should return a number.');
|
||||
testString: assert(typeof(getIndexToIns([3, 10, 5], 3)) === "number");
|
||||
- text: <code>getIndexToIns([5, 3, 20, 3], 5)</code> should return <code>2</code>.
|
||||
testString: assert(getIndexToIns([5, 3, 20, 3], 5) === 2, '<code>getIndexToIns([5, 3, 20, 3], 5)</code> should return <code>2</code>.');
|
||||
testString: assert(getIndexToIns([5, 3, 20, 3], 5) === 2);
|
||||
- text: <code>getIndexToIns([5, 3, 20, 3], 5)</code> should return a number.
|
||||
testString: assert(typeof(getIndexToIns([5, 3, 20, 3], 5)) === "number", '<code>getIndexToIns([5, 3, 20, 3], 5)</code> should return a number.');
|
||||
testString: assert(typeof(getIndexToIns([5, 3, 20, 3], 5)) === "number");
|
||||
- text: <code>getIndexToIns([2, 20, 10], 19)</code> should return <code>2</code>.
|
||||
testString: assert(getIndexToIns([2, 20, 10], 19) === 2, '<code>getIndexToIns([2, 20, 10], 19)</code> should return <code>2</code>.');
|
||||
testString: assert(getIndexToIns([2, 20, 10], 19) === 2);
|
||||
- text: <code>getIndexToIns([2, 20, 10], 19)</code> should return a number.
|
||||
testString: assert(typeof(getIndexToIns([2, 20, 10], 19)) === "number", '<code>getIndexToIns([2, 20, 10], 19)</code> should return a number.');
|
||||
testString: assert(typeof(getIndexToIns([2, 20, 10], 19)) === "number");
|
||||
- text: <code>getIndexToIns([2, 5, 10], 15)</code> should return <code>3</code>.
|
||||
testString: assert(getIndexToIns([2, 5, 10], 15) === 3, '<code>getIndexToIns([2, 5, 10], 15)</code> should return <code>3</code>.');
|
||||
testString: assert(getIndexToIns([2, 5, 10], 15) === 3);
|
||||
- text: <code>getIndexToIns([2, 5, 10], 15)</code> should return a number.
|
||||
testString: assert(typeof(getIndexToIns([2, 5, 10], 15)) === "number", '<code>getIndexToIns([2, 5, 10], 15)</code> should return a number.');
|
||||
testString: assert(typeof(getIndexToIns([2, 5, 10], 15)) === "number");
|
||||
- text: <code>getIndexToIns([], 1)</code> should return <code>0</code>.
|
||||
testString: assert(getIndexToIns([], 1) === 0, '<code>getIndexToIns([], 1)</code> should return <code>0</code>.');
|
||||
testString: assert(getIndexToIns([], 1) === 0);
|
||||
- text: <code>getIndexToIns([], 1)</code> should return a number.
|
||||
testString: assert(typeof(getIndexToIns([], 1)) === "number", '<code>getIndexToIns([], 1)</code> should return a number.');
|
||||
testString: assert(typeof(getIndexToIns([], 1)) === "number");
|
||||
|
||||
```
|
||||
|
||||
|
@ -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));
|
||||
|
||||
```
|
||||
|
||||
|
@ -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));
|
||||
|
||||
```
|
||||
|
||||
|
@ -30,15 +30,15 @@ Change the <code>nonMutatingPush</code> function so it uses <code>concat</code>
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>concat</code> method.
|
||||
testString: assert(code.match(/\.concat/g), 'Your code should use the <code>concat</code> method.');
|
||||
testString: assert(code.match(/\.concat/g));
|
||||
- text: Your code should not use the <code>push</code> method.
|
||||
testString: assert(!code.match(/\.push/g), 'Your code should not use the <code>push</code> method.');
|
||||
testString: assert(!code.match(/\.push/g));
|
||||
- text: The <code>first</code> array should not change.
|
||||
testString: assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]), 'The <code>first</code> array should not change.');
|
||||
testString: assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]));
|
||||
- text: The <code>second</code> array should not change.
|
||||
testString: assert(JSON.stringify(second) === JSON.stringify([4, 5]), 'The <code>second</code> array should not change.');
|
||||
testString: assert(JSON.stringify(second) === JSON.stringify([4, 5]));
|
||||
- text: <code>nonMutatingPush([1, 2, 3], [4, 5])</code> should return <code>[1, 2, 3, 4, 5]</code>.
|
||||
testString: assert(JSON.stringify(nonMutatingPush([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]), '<code>nonMutatingPush([1, 2, 3], [4, 5])</code> should return <code>[1, 2, 3, 4, 5]</code>.');
|
||||
testString: assert(JSON.stringify(nonMutatingPush([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]));
|
||||
|
||||
```
|
||||
|
||||
|
@ -26,17 +26,17 @@ The output should not have any spaces
|
||||
```yml
|
||||
tests:
|
||||
- text: The <code>globalTitle</code> variable should not change.
|
||||
testString: assert(globalTitle === "Winter Is Coming", 'The <code>globalTitle</code> variable should not change.');
|
||||
testString: assert(globalTitle === "Winter Is Coming");
|
||||
- text: Your code should not use the <code>replace</code> method for this challenge.
|
||||
testString: assert(!code.match(/\.replace/g), 'Your code should not use the <code>replace</code> method for this challenge.');
|
||||
testString: assert(!code.match(/\.replace/g));
|
||||
- text: <code>urlSlug("Winter Is Coming")</code> should return <code>"winter-is-coming"</code>.
|
||||
testString: assert(urlSlug("Winter Is Coming") === "winter-is-coming", '<code>urlSlug("Winter Is Coming")</code> should return <code>"winter-is-coming"</code>.');
|
||||
testString: assert(urlSlug("Winter Is Coming") === "winter-is-coming");
|
||||
- text: <code>urlSlug(" Winter Is Coming")</code> should return <code>"winter-is-coming"</code>.
|
||||
testString: assert(urlSlug(" Winter Is Coming") === "winter-is-coming", '<code>urlSlug(" Winter Is Coming")</code> should return <code>"winter-is-coming"</code>.');
|
||||
testString: assert(urlSlug(" Winter Is Coming") === "winter-is-coming");
|
||||
- text: <code>urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone")</code> should return <code>"a-mind-needs-books-like-a-sword-needs-a-whetstone"</code>.
|
||||
testString: assert(urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone") === "a-mind-needs-books-like-a-sword-needs-a-whetstone", '<code>urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone")</code> should return <code>"a-mind-needs-books-like-a-sword-needs-a-whetstone"</code>.');
|
||||
testString: assert(urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone") === "a-mind-needs-books-like-a-sword-needs-a-whetstone");
|
||||
- text: <code>urlSlug("Hold The Door")</code> should return <code>"hold-the-door"</code>.
|
||||
testString: assert(urlSlug("Hold The Door") === "hold-the-door", '<code>urlSlug("Hold The Door")</code> should return <code>"hold-the-door"</code>.');
|
||||
testString: assert(urlSlug("Hold The Door") === "hold-the-door");
|
||||
|
||||
```
|
||||
|
||||
|
@ -25,9 +25,9 @@ Fill in the code for the function <code>incrementer</code> so it returns the val
|
||||
```yml
|
||||
tests:
|
||||
- text: Your function <code>incrementer</code> should not change the value of <code>fixedValue</code>.
|
||||
testString: assert(fixedValue === 4, 'Your function <code>incrementer</code> should not change the value of <code>fixedValue</code>.');
|
||||
testString: assert(fixedValue === 4);
|
||||
- text: Your <code>incrementer</code> function should return a value that is one larger than the <code>fixedValue</code> value.
|
||||
testString: assert(newValue === 5, 'Your <code>incrementer</code> function should return a value that is one larger than the <code>fixedValue</code> value.');
|
||||
testString: assert(newValue === 5);
|
||||
|
||||
```
|
||||
|
||||
|
@ -28,17 +28,17 @@ Use the <code>join</code> method (among others) inside the <code>sentensify</cod
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>join</code> method.
|
||||
testString: assert(code.match(/\.join/g), 'Your code should use the <code>join</code> method.');
|
||||
testString: assert(code.match(/\.join/g));
|
||||
- text: Your code should not use the <code>replace</code> method.
|
||||
testString: assert(!code.match(/\.replace/g), 'Your code should not use the <code>replace</code> method.');
|
||||
testString: assert(!code.match(/\.replace/g));
|
||||
- text: <code>sentensify("May-the-force-be-with-you")</code> should return a string.
|
||||
testString: assert(typeof sentensify("May-the-force-be-with-you") === "string", '<code>sentensify("May-the-force-be-with-you")</code> should return a string.');
|
||||
testString: assert(typeof sentensify("May-the-force-be-with-you") === "string");
|
||||
- text: <code>sentensify("May-the-force-be-with-you")</code> should return <code>"May the force be with you"</code>.
|
||||
testString: assert(sentensify("May-the-force-be-with-you") === "May the force be with you", '<code>sentensify("May-the-force-be-with-you")</code> should return <code>"May the force be with you"</code>.');
|
||||
testString: assert(sentensify("May-the-force-be-with-you") === "May the force be with you");
|
||||
- text: <code>sentensify("The.force.is.strong.with.this.one")</code> should return <code>"The force is strong with this one"</code>.
|
||||
testString: assert(sentensify("The.force.is.strong.with.this.one") === "The force is strong with this one", '<code>sentensify("The.force.is.strong.with.this.one")</code> should return <code>"The force is strong with this one"</code>.');
|
||||
testString: assert(sentensify("The.force.is.strong.with.this.one") === "The force is strong with this one");
|
||||
- text: <code>sentensify("There,has,been,an,awakening")</code> should return <code>"There has been an awakening"</code>.
|
||||
testString: assert(sentensify("There,has,been,an,awakening") === "There has been an awakening", '<code>sentensify("There,has,been,an,awakening")</code> should return <code>"There has been an awakening"</code>.');
|
||||
testString: assert(sentensify("There,has,been,an,awakening") === "There has been an awakening");
|
||||
|
||||
```
|
||||
|
||||
|
@ -26,13 +26,13 @@ Use the <code>concat</code> method in the <code>nonMutatingConcat</code> functio
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>concat</code> method.
|
||||
testString: assert(code.match(/\.concat/g), 'Your code should use the <code>concat</code> method.');
|
||||
testString: assert(code.match(/\.concat/g));
|
||||
- text: The <code>first</code> array should not change.
|
||||
testString: assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]), 'The <code>first</code> array should not change.');
|
||||
testString: assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]));
|
||||
- text: The <code>second</code> array should not change.
|
||||
testString: assert(JSON.stringify(second) === JSON.stringify([4, 5]), 'The <code>second</code> array should not change.');
|
||||
testString: assert(JSON.stringify(second) === JSON.stringify([4, 5]));
|
||||
- text: <code>nonMutatingConcat([1, 2, 3], [4, 5])</code> should return <code>[1, 2, 3, 4, 5]</code>.
|
||||
testString: assert(JSON.stringify(nonMutatingConcat([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]), '<code>nonMutatingConcat([1, 2, 3], [4, 5])</code> should return <code>[1, 2, 3, 4, 5]</code>.');
|
||||
testString: assert(JSON.stringify(nonMutatingConcat([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]));
|
||||
|
||||
```
|
||||
|
||||
|
@ -23,9 +23,9 @@ Write your own <code>Array.prototype.myMap()</code>, which should behave exactly
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>new_s</code> should equal <code>[46, 130, 196, 10]</code>.
|
||||
testString: assert(JSON.stringify(new_s) === JSON.stringify([46, 130, 196, 10]), '<code>new_s</code> should equal <code>[46, 130, 196, 10]</code>.');
|
||||
testString: assert(JSON.stringify(new_s) === JSON.stringify([46, 130, 196, 10]));
|
||||
- text: Your code should not use the <code>map</code> method.
|
||||
testString: assert(!code.match(/\.map/g), 'Your code should not use the <code>map</code> method.');
|
||||
testString: assert(!code.match(/\.map/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -21,9 +21,9 @@ Write your own <code>Array.prototype.myFilter()</code>, which should behave exac
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>new_s</code> should equal <code>[23, 65, 5]</code>.
|
||||
testString: assert(JSON.stringify(new_s) === JSON.stringify([23, 65, 5]), '<code>new_s</code> should equal <code>[23, 65, 5]</code>.');
|
||||
testString: assert(JSON.stringify(new_s) === JSON.stringify([23, 65, 5]));
|
||||
- text: Your code should not use the <code>filter</code> method.
|
||||
testString: assert(!code.match(/\.filter/g), 'Your code should not use the <code>filter</code> method.');
|
||||
testString: assert(!code.match(/\.filter/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -61,13 +61,13 @@ Fill in the body of the <code>add</code> function so it uses currying to add par
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>add(10)(20)(30)</code> should return <code>60</code>.
|
||||
testString: assert(add(10)(20)(30) === 60, '<code>add(10)(20)(30)</code> should return <code>60</code>.');
|
||||
testString: assert(add(10)(20)(30) === 60);
|
||||
- text: <code>add(1)(2)(3)</code> should return <code>6</code>.
|
||||
testString: assert(add(1)(2)(3) === 6, '<code>add(1)(2)(3)</code> should return <code>6</code>.');
|
||||
testString: assert(add(1)(2)(3) === 6);
|
||||
- text: <code>add(11)(22)(33)</code> should return <code>66</code>.
|
||||
testString: assert(add(11)(22)(33) === 66, '<code>add(11)(22)(33)</code> should return <code>66</code>.');
|
||||
testString: assert(add(11)(22)(33) === 66);
|
||||
- text: Your code should include a final statement that returns <code>x + y + z</code>.
|
||||
testString: assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g), 'Your code should include a final statement that returns <code>x + y + z</code>.');
|
||||
testString: assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -26,9 +26,9 @@ In the code editor, the <code>prepareTea</code> and <code>getTea</code> function
|
||||
```yml
|
||||
tests:
|
||||
- text: The <code>tea4TeamFCC</code> variable should hold 40 cups of tea for the team.
|
||||
testString: assert(tea4TeamFCC.length === 40, 'The <code>tea4TeamFCC</code> variable should hold 40 cups of tea for the team.');
|
||||
testString: assert(tea4TeamFCC.length === 40);
|
||||
- text: The <code>tea4TeamFCC</code> variable should hold cups of green tea.
|
||||
testString: assert(tea4TeamFCC[0] === 'greenTea', 'The <code>tea4TeamFCC</code> variable should hold cups of green tea.');
|
||||
testString: assert(tea4TeamFCC[0] === 'greenTea');
|
||||
|
||||
```
|
||||
|
||||
|
@ -26,11 +26,11 @@ Write the <code>incrementer</code> function so it takes an argument, and then in
|
||||
```yml
|
||||
tests:
|
||||
- text: Your function <code>incrementer</code> should not change the value of <code>fixedValue</code>.
|
||||
testString: assert(fixedValue === 4, 'Your function <code>incrementer</code> should not change the value of <code>fixedValue</code>.');
|
||||
testString: assert(fixedValue === 4);
|
||||
- text: Your <code>incrementer</code> function should take a parameter.
|
||||
testString: assert(incrementer.length === 1, 'Your <code>incrementer</code> function should take a parameter.');
|
||||
testString: assert(incrementer.length === 1);
|
||||
- text: Your <code>incrementer</code> function should return a value that is one larger than the <code>fixedValue</code> value.
|
||||
testString: assert(newValue === 5, 'Your <code>incrementer</code> function should return a value that is one larger than the <code>fixedValue</code> value.');
|
||||
testString: assert(newValue === 5);
|
||||
|
||||
```
|
||||
|
||||
|
@ -23,7 +23,7 @@ Rewrite the code so the global array <code>bookList</code> is not changed inside
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>bookList</code> should not change and still equal <code>["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]</code>.
|
||||
testString: assert(JSON.stringify(bookList) === JSON.stringify(["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]), '<code>bookList</code> should not change and still equal <code>["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]</code>.');
|
||||
testString: assert(JSON.stringify(bookList) === JSON.stringify(["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]));
|
||||
- text: <code>newBookList</code> should equal <code>["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]</code>.
|
||||
testString: assert(JSON.stringify(newBookList) === JSON.stringify(['The Hound of the Baskervilles', 'On The Electrodynamics of Moving Bodies', 'Philosophiæ Naturalis Principia Mathematica', 'Disquisitiones Arithmeticae', 'A Brief History of Time']), '<code>newBookList</code> should equal <code>["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]</code>.');
|
||||
- text: <code>newerBookList</code> should equal <code>["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]</code>.
|
||||
|
@ -29,13 +29,13 @@ Do not mutate the original array provided to the function.
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>slice</code> method.
|
||||
testString: assert(code.match(/\.slice/g), 'Your code should use the <code>slice</code> method.');
|
||||
testString: assert(code.match(/\.slice/g));
|
||||
- text: Your code should not use the <code>splice</code> method.
|
||||
testString: assert(!code.match(/\.splice/g), 'Your code should not use the <code>splice</code> method.');
|
||||
testString: assert(!code.match(/\.splice/g));
|
||||
- text: The <code>inputCities</code> array should not change.
|
||||
testString: assert(JSON.stringify(inputCities) === JSON.stringify(["Chicago", "Delhi", "Islamabad", "London", "Berlin"]), 'The <code>inputCities</code> array should not change.');
|
||||
testString: assert(JSON.stringify(inputCities) === JSON.stringify(["Chicago", "Delhi", "Islamabad", "London", "Berlin"]));
|
||||
- text: <code>nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])</code> should return <code>["Chicago", "Delhi", "Islamabad"]</code>.
|
||||
testString: assert(JSON.stringify(nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])) === JSON.stringify(["Chicago", "Delhi", "Islamabad"]), '<code>nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])</code> should return <code>["Chicago", "Delhi", "Islamabad"]</code>.');
|
||||
testString: assert(JSON.stringify(nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])) === JSON.stringify(["Chicago", "Delhi", "Islamabad"]));
|
||||
|
||||
```
|
||||
|
||||
|
@ -28,15 +28,15 @@ Use the <code>slice</code> method in the <code>sliceArray</code> function to ret
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>slice</code> method.
|
||||
testString: assert(code.match(/\.slice/g), 'Your code should use the <code>slice</code> method.');
|
||||
testString: assert(code.match(/\.slice/g));
|
||||
- text: The <code>inputAnim</code> variable should not change.
|
||||
testString: assert(JSON.stringify(inputAnim) === JSON.stringify(["Cat", "Dog", "Tiger", "Zebra", "Ant"]), 'The <code>inputAnim</code> variable should not change.');
|
||||
testString: assert(JSON.stringify(inputAnim) === JSON.stringify(["Cat", "Dog", "Tiger", "Zebra", "Ant"]));
|
||||
- text: <code>sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)</code> should return <code>["Dog", "Tiger"]</code>.
|
||||
testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)) === JSON.stringify(["Dog", "Tiger"]), '<code>sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)</code> should return <code>["Dog", "Tiger"]</code>.');
|
||||
testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)) === JSON.stringify(["Dog", "Tiger"]));
|
||||
- text: <code>sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)</code> should return <code>["Cat"]</code>.
|
||||
testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)) === JSON.stringify(["Cat"]), '<code>sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)</code> should return <code>["Cat"]</code>.');
|
||||
testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)) === JSON.stringify(["Cat"]));
|
||||
- text: <code>sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)</code> should return <code>["Dog", "Tiger", "Zebra"]</code>.
|
||||
testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)) === JSON.stringify(["Dog", "Tiger", "Zebra"]), '<code>sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)</code> should return <code>["Dog", "Tiger", "Zebra"]</code>.');
|
||||
testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)) === JSON.stringify(["Dog", "Tiger", "Zebra"]));
|
||||
|
||||
```
|
||||
|
||||
|
@ -45,13 +45,13 @@ Use the <code>sort</code> method in the <code>alphabeticalOrder</code> function
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>sort</code> method.
|
||||
testString: assert(code.match(/\.sort/g), 'Your code should use the <code>sort</code> method.');
|
||||
testString: assert(code.match(/\.sort/g));
|
||||
- text: <code>alphabeticalOrder(["a", "d", "c", "a", "z", "g"])</code> should return <code>["a", "a", "c", "d", "g", "z"]</code>.
|
||||
testString: assert(JSON.stringify(alphabeticalOrder(["a", "d", "c", "a", "z", "g"])) === JSON.stringify(["a", "a", "c", "d", "g", "z"]), '<code>alphabeticalOrder(["a", "d", "c", "a", "z", "g"])</code> should return <code>["a", "a", "c", "d", "g", "z"]</code>.');
|
||||
testString: assert(JSON.stringify(alphabeticalOrder(["a", "d", "c", "a", "z", "g"])) === JSON.stringify(["a", "a", "c", "d", "g", "z"]));
|
||||
- text: <code>alphabeticalOrder(["x", "h", "a", "m", "n", "m"])</code> should return <code>["a", "h", "m", "m", "n", "x"]</code>.
|
||||
testString: assert(JSON.stringify(alphabeticalOrder(["x", "h", "a", "m", "n", "m"])) === JSON.stringify(["a", "h", "m", "m", "n", "x"]), '<code>alphabeticalOrder(["x", "h", "a", "m", "n", "m"])</code> should return <code>["a", "h", "m", "m", "n", "x"]</code>.');
|
||||
testString: assert(JSON.stringify(alphabeticalOrder(["x", "h", "a", "m", "n", "m"])) === JSON.stringify(["a", "h", "m", "m", "n", "x"]));
|
||||
- text: <code>alphabeticalOrder(["a", "a", "a", "a", "x", "t"])</code> should return <code>["a", "a", "a", "a", "t", "x"]</code>.
|
||||
testString: assert(JSON.stringify(alphabeticalOrder(["a", "a", "a", "a", "x", "t"])) === JSON.stringify(["a", "a", "a", "a", "t", "x"]), '<code>alphabeticalOrder(["a", "a", "a", "a", "x", "t"])</code> should return <code>["a", "a", "a", "a", "t", "x"]</code>.');
|
||||
testString: assert(JSON.stringify(alphabeticalOrder(["a", "a", "a", "a", "x", "t"])) === JSON.stringify(["a", "a", "a", "a", "t", "x"]));
|
||||
|
||||
```
|
||||
|
||||
|
@ -33,13 +33,13 @@ Use the <code>split</code> method inside the <code>splitify</code> function to s
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>split</code> method.
|
||||
testString: assert(code.match(/\.split/g), 'Your code should use the <code>split</code> method.');
|
||||
testString: assert(code.match(/\.split/g));
|
||||
- text: <code>splitify("Hello World,I-am code")</code> should return <code>["Hello", "World", "I", "am", "code"]</code>.
|
||||
testString: assert(JSON.stringify(splitify("Hello World,I-am code")) === JSON.stringify(["Hello", "World", "I", "am", "code"]), '<code>splitify("Hello World,I-am code")</code> should return <code>["Hello", "World", "I", "am", "code"]</code>.');
|
||||
testString: assert(JSON.stringify(splitify("Hello World,I-am code")) === JSON.stringify(["Hello", "World", "I", "am", "code"]));
|
||||
- text: <code>splitify("Earth-is-our home")</code> should return <code>["Earth", "is", "our", "home"]</code>.
|
||||
testString: assert(JSON.stringify(splitify("Earth-is-our home")) === JSON.stringify(["Earth", "is", "our", "home"]), '<code>splitify("Earth-is-our home")</code> should return <code>["Earth", "is", "our", "home"]</code>.');
|
||||
testString: assert(JSON.stringify(splitify("Earth-is-our home")) === JSON.stringify(["Earth", "is", "our", "home"]));
|
||||
- text: <code>splitify("This.is.a-sentence")</code> should return <code>["This", "is", "a", "sentence"]</code>.
|
||||
testString: assert(JSON.stringify(splitify("This.is.a-sentence")) === JSON.stringify(["This", "is", "a", "sentence"]), '<code>splitify("This.is.a-sentence")</code> should return <code>["This", "is", "a", "sentence"]</code>.');
|
||||
testString: assert(JSON.stringify(splitify("This.is.a-sentence")) === JSON.stringify(["This", "is", "a", "sentence"]));
|
||||
|
||||
```
|
||||
|
||||
|
@ -27,13 +27,13 @@ Note: The data (the number of cups of tea) is supplied as the last argument. We'
|
||||
```yml
|
||||
tests:
|
||||
- text: The <code>tea4GreenTeamFCC</code> variable should hold 27 cups of green tea for the team.
|
||||
testString: assert(tea4GreenTeamFCC.length === 27, 'The <code>tea4GreenTeamFCC</code> variable should hold 27 cups of green tea for the team.');
|
||||
testString: assert(tea4GreenTeamFCC.length === 27);
|
||||
- text: The <code>tea4GreenTeamFCC</code> variable should hold cups of green tea.
|
||||
testString: assert(tea4GreenTeamFCC[0] === 'greenTea', 'The <code>tea4GreenTeamFCC</code> variable should hold cups of green tea.');
|
||||
testString: assert(tea4GreenTeamFCC[0] === 'greenTea');
|
||||
- text: The <code>tea4BlackTeamFCC</code> variable should hold 13 cups of black tea.
|
||||
testString: assert(tea4BlackTeamFCC.length === 13, 'The <code>tea4BlackTeamFCC</code> variable should hold 13 cups of black tea.');
|
||||
testString: assert(tea4BlackTeamFCC.length === 13);
|
||||
- text: The <code>tea4BlackTeamFCC</code> variable should hold cups of black tea.
|
||||
testString: assert(tea4BlackTeamFCC[0] === 'blackTea', 'The <code>tea4BlackTeamFCC</code> variable should hold cups of black tea.');
|
||||
testString: assert(tea4BlackTeamFCC[0] === 'blackTea');
|
||||
|
||||
```
|
||||
|
||||
|
@ -30,13 +30,13 @@ Use the <code>every</code> method inside the <code>checkPositive</code> function
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>every</code> method.
|
||||
testString: assert(code.match(/\.every/g), 'Your code should use the <code>every</code> method.');
|
||||
testString: assert(code.match(/\.every/g));
|
||||
- text: <code>checkPositive([1, 2, 3, -4, 5])</code> should return <code>false</code>.
|
||||
testString: assert(!checkPositive([1, 2, 3, -4, 5]), '<code>checkPositive([1, 2, 3, -4, 5])</code> should return <code>false</code>.');
|
||||
testString: assert(!checkPositive([1, 2, 3, -4, 5]));
|
||||
- text: <code>checkPositive([1, 2, 3, 4, 5])</code> should return <code>true</code>.
|
||||
testString: assert(checkPositive([1, 2, 3, 4, 5]), '<code>checkPositive([1, 2, 3, 4, 5])</code> should return <code>true</code>.');
|
||||
testString: assert(checkPositive([1, 2, 3, 4, 5]));
|
||||
- text: <code>checkPositive([1, -2, 3, -4, 5])</code> should return <code>false</code>.
|
||||
testString: assert(!checkPositive([1, -2, 3, -4, 5]), '<code>checkPositive([1, -2, 3, -4, 5])</code> should return <code>false</code>.');
|
||||
testString: assert(!checkPositive([1, -2, 3, -4, 5]));
|
||||
|
||||
```
|
||||
|
||||
|
@ -21,11 +21,11 @@ The variable <code>watchList</code> holds an array of objects with information o
|
||||
```yml
|
||||
tests:
|
||||
- text: The <code>watchList</code> variable should not change.
|
||||
testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron", 'The <code>watchList</code> variable should not change.');
|
||||
testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron");
|
||||
- text: Your code should use the <code>filter</code> method.
|
||||
testString: assert(code.match(/\.filter/g), 'Your code should use the <code>filter</code> method.');
|
||||
testString: assert(code.match(/\.filter/g));
|
||||
- text: Your code should not use a <code>for</code> loop.
|
||||
testString: assert(!code.match(/for\s*?\(.+?\)/g), 'Your code should not use a <code>for</code> loop.');
|
||||
testString: assert(!code.match(/for\s*?\(.+?\)/g));
|
||||
- text: '<code>filteredList</code> should equal <code>[{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}]</code>.'
|
||||
testString: 'assert.deepEqual(filteredList, [{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}], ''<code>filteredList</code> should equal <code>[{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}]</code>.'');'
|
||||
|
||||
|
@ -23,15 +23,15 @@ The variable <code>watchList</code> holds an array of objects with information o
|
||||
```yml
|
||||
tests:
|
||||
- text: The <code>watchList</code> variable should not change.
|
||||
testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron", 'The <code>watchList</code> variable should not change.');
|
||||
testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron");
|
||||
- text: Your code should use the <code>reduce</code> method.
|
||||
testString: assert(code.match(/\.reduce/g), 'Your code should use the <code>reduce</code> method.');
|
||||
testString: assert(code.match(/\.reduce/g));
|
||||
- text: The <code>getRating(watchList)</code> should equal 8.675.
|
||||
testString: assert(getRating(watchList) === 8.675, 'The <code>getRating(watchList)</code> should equal 8.675.');
|
||||
testString: assert(getRating(watchList) === 8.675);
|
||||
- text: Your code should not use a <code>for</code> loop.
|
||||
testString: assert(!code.match(/for\s*?\(.*\)/g), 'Your code should not use a <code>for</code> loop.');
|
||||
testString: assert(!code.match(/for\s*?\(.*\)/g));
|
||||
- text: Your code should return correct output after modifying the <code>watchList</code> object.
|
||||
testString: assert(getRating(watchList.filter((_, i) => i < 1 || i > 2)) === 8.55, 'Your code should return correct output after modifying the <code>watchList</code> object');
|
||||
testString: assert(getRating(watchList.filter((_, i) => i < 1 || i > 2)) === 8.55);
|
||||
|
||||
```
|
||||
|
||||
|
@ -30,13 +30,13 @@ Use the <code>some</code> method inside the <code>checkPositive</code> function
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>some</code> method.
|
||||
testString: assert(code.match(/\.some/g), 'Your code should use the <code>some</code> method.');
|
||||
testString: assert(code.match(/\.some/g));
|
||||
- text: <code>checkPositive([1, 2, 3, -4, 5])</code> should return <code>true</code>.
|
||||
testString: assert(checkPositive([1, 2, 3, -4, 5]), '<code>checkPositive([1, 2, 3, -4, 5])</code> should return <code>true</code>.');
|
||||
testString: assert(checkPositive([1, 2, 3, -4, 5]));
|
||||
- text: <code>checkPositive([1, 2, 3, 4, 5])</code> should return <code>true</code>.
|
||||
testString: assert(checkPositive([1, 2, 3, 4, 5]), '<code>checkPositive([1, 2, 3, 4, 5])</code> should return <code>true</code>.');
|
||||
testString: assert(checkPositive([1, 2, 3, 4, 5]));
|
||||
- text: <code>checkPositive([-1, -2, -3, -4, -5])</code> should return <code>false</code>.
|
||||
testString: assert(!checkPositive([-1, -2, -3, -4, -5]), '<code>checkPositive([-1, -2, -3, -4, -5])</code> should return <code>false</code>.');
|
||||
testString: assert(!checkPositive([-1, -2, -3, -4, -5]));
|
||||
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user