fix(curriculum): Remove unnecessary assert message argument from English challenges JavaScript Algorithms and Data Structures - 01 (#36401)

* fix: rm assert msg basic-javascript

* fix: removed more assert msg args

* fix: fixed verbiage

Co-Authored-By: Parth Parth <34807532+thecodingaviator@users.noreply.github.com>
This commit is contained in:
Randell Dawson
2019-07-13 00:07:53 -07:00
committed by Parth Parth
parent 2cf2838674
commit e9212c61d2
102 changed files with 415 additions and 415 deletions

View File

@ -32,9 +32,9 @@ Create a variable called <code>myData</code> and set it to equal the first value
```yml
tests:
- text: The variable <code>myData</code> should equal the first value of <code>myArray</code>.
testString: assert((function(){if(typeof myArray !== 'undefined' && typeof myData !== 'undefined' && myArray[0] === myData){return true;}else{return false;}})(), 'The variable <code>myData</code> should equal the first value of <code>myArray</code>.');
testString: assert((function(){if(typeof myArray !== 'undefined' && typeof myData !== 'undefined' && myArray[0] === myData){return true;}else{return false;}})());
- text: The data in variable <code>myArray</code> should be accessed using bracket notation.
testString: assert((function(){if(code.match(/\s*=\s*myArray\[0\]/g)){return true;}else{return false;}})(), 'The data in variable <code>myArray</code> should be accessed using bracket notation.');
testString: assert((function(){if(code.match(/\s*=\s*myArray\[0\]/g)){return true;}else{return false;}})());
```

View File

@ -36,7 +36,7 @@ Using bracket notation select an element from <code>myArray</code> such that <co
```yml
tests:
- text: <code>myData</code> should be equal to <code>8</code>.
testString: assert(myData === 8, '<code>myData</code> should be equal to <code>8</code>.');
testString: assert(myData === 8);
- text: You should be using bracket notation to read the correct value from <code>myArray</code>.
testString: assert(/myData=myArray\[2\]\[1\]/.test(code.replace(/\s/g, '')));

View File

@ -46,9 +46,9 @@ Retrieve the second tree from the variable <code>myPlants</code> using object do
```yml
tests:
- text: <code>secondTree</code> should equal "pine"
testString: assert(secondTree === "pine", '<code>secondTree</code> should equal "pine"');
testString: assert(secondTree === "pine");
- text: Use dot and bracket notation to access <code>myPlants</code>
testString: assert(/=\s*myPlants\[1\].list\[1\]/.test(code), 'Use dot and bracket notation to access <code>myPlants</code>');
testString: assert(/=\s*myPlants\[1\].list\[1\]/.test(code));
```

View File

@ -40,9 +40,9 @@ Access the <code>myStorage</code> object and assign the contents of the <code>gl
```yml
tests:
- text: <code>gloveBoxContents</code> should equal "maps"
testString: assert(gloveBoxContents === "maps", '<code>gloveBoxContents</code> should equal "maps"');
testString: assert(gloveBoxContents === "maps");
- text: Use dot and bracket notation to access <code>myStorage</code>
testString: assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code), 'Use dot and bracket notation to access <code>myStorage</code>');
testString: assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));
```

View File

@ -36,15 +36,15 @@ Read the values of the properties <code>"an entree"</code> and <code>"the drink"
```yml
tests:
- text: <code>entreeValue</code> should be a string
testString: assert(typeof entreeValue === 'string' , '<code>entreeValue</code> should be a string');
testString: assert(typeof entreeValue === 'string' );
- text: The value of <code>entreeValue</code> should be <code>"hamburger"</code>
testString: assert(entreeValue === 'hamburger' , 'The value of <code>entreeValue</code> should be <code>"hamburger"</code>');
testString: assert(entreeValue === 'hamburger' );
- text: <code>drinkValue</code> should be a string
testString: assert(typeof drinkValue === 'string' , '<code>drinkValue</code> should be a string');
testString: assert(typeof drinkValue === 'string' );
- text: The value of <code>drinkValue</code> should be <code>"water"</code>
testString: assert(drinkValue === 'water' , 'The value of <code>drinkValue</code> should be <code>"water"</code>');
testString: assert(drinkValue === 'water' );
- text: You should use bracket notation twice
testString: assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1, 'You should use bracket notation twice');
testString: assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1);
```

View File

@ -33,15 +33,15 @@ Read in the property values of <code>testObj</code> using dot notation. Set the
```yml
tests:
- text: <code>hatValue</code> should be a string
testString: assert(typeof hatValue === 'string' , '<code>hatValue</code> should be a string');
testString: assert(typeof hatValue === 'string' );
- text: The value of <code>hatValue</code> should be <code>"ballcap"</code>
testString: assert(hatValue === 'ballcap' , 'The value of <code>hatValue</code> should be <code>"ballcap"</code>');
testString: assert(hatValue === 'ballcap' );
- text: <code>shirtValue</code> should be a string
testString: assert(typeof shirtValue === 'string' , '<code>shirtValue</code> should be a string');
testString: assert(typeof shirtValue === 'string' );
- text: The value of <code>shirtValue</code> should be <code>"jersey"</code>
testString: assert(shirtValue === 'jersey' , 'The value of <code>shirtValue</code> should be <code>"jersey"</code>');
testString: assert(shirtValue === 'jersey' );
- text: You should use dot notation twice
testString: assert(code.match(/testObj\.\w+/g).length > 1, 'You should use dot notation twice');
testString: assert(code.match(/testObj\.\w+/g).length > 1);
```

View File

@ -47,17 +47,17 @@ Use the <code>playerNumber</code> variable to look up player <code>16</code> in
```yml
tests:
- text: <code>playerNumber</code> should be a number
testString: assert(typeof playerNumber === 'number', '<code>playerNumber</code> should be a number');
testString: assert(typeof playerNumber === 'number');
- text: The variable <code>player</code> should be a string
testString: assert(typeof player === 'string', 'The variable <code>player</code> should be a string');
testString: assert(typeof player === 'string');
- text: The value of <code>player</code> should be "Montana"
testString: assert(player === 'Montana', 'The value of <code>player</code> should be "Montana"');
testString: assert(player === 'Montana');
- text: You should use bracket notation to access <code>testObj</code>
testString: assert(/testObj\s*?\[.*?\]/.test(code),'You should use bracket notation to access <code>testObj</code>');
testString: assert(/testObj\s*?\[.*?\]/.test(code));
- text: You should not assign the value <code>Montana</code> to the variable <code>player</code> directly.
testString: assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi),'You should not assign the value <code>Montana</code> to the variable <code>player</code> directly.');
testString: assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi));
- text: You should be using the variable <code>playerNumber</code> in your bracket notation
testString: assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code),'You should be using the variable <code>playerNumber</code> in your bracket notation');
testString: assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code));
```

View File

@ -26,9 +26,9 @@ Add a <code>"bark"</code> property to <code>myDog</code> and set it to a dog sou
```yml
tests:
- text: Add the property <code>"bark"</code> to <code>myDog</code>.
testString: assert(myDog.bark !== undefined, 'Add the property <code>"bark"</code> to <code>myDog</code>.');
testString: assert(myDog.bark !== undefined);
- text: Do not add <code>"bark"</code> to the setup section
testString: assert(!/bark[^\n]:/.test(code), 'Do not add <code>"bark"</code> to the setup section');
testString: assert(!/bark[^\n]:/.test(code));
```

View File

@ -29,9 +29,9 @@ Change the <code>0</code> so that sum will equal <code>20</code>.
```yml
tests:
- text: <code>sum</code> should equal <code>20</code>
testString: assert(sum === 20, '<code>sum</code> should equal <code>20</code>');
testString: assert(sum === 20);
- text: Use the <code>+</code> operator
testString: assert(/\+/.test(code), 'Use the <code>+</code> operator');
testString: assert(/\+/.test(code));
```

View File

@ -38,21 +38,21 @@ Write a switch statement to set <code>answer</code> for the following conditions
```yml
tests:
- text: <code>switchOfStuff("a")</code> should have a value of "apple"
testString: assert(switchOfStuff("a") === "apple", '<code>switchOfStuff("a")</code> should have a value of "apple"');
testString: assert(switchOfStuff("a") === "apple");
- text: <code>switchOfStuff("b")</code> should have a value of "bird"
testString: assert(switchOfStuff("b") === "bird", '<code>switchOfStuff("b")</code> should have a value of "bird"');
testString: assert(switchOfStuff("b") === "bird");
- text: <code>switchOfStuff("c")</code> should have a value of "cat"
testString: assert(switchOfStuff("c") === "cat", '<code>switchOfStuff("c")</code> should have a value of "cat"');
testString: assert(switchOfStuff("c") === "cat");
- text: <code>switchOfStuff("d")</code> should have a value of "stuff"
testString: assert(switchOfStuff("d") === "stuff", '<code>switchOfStuff("d")</code> should have a value of "stuff"');
testString: assert(switchOfStuff("d") === "stuff");
- text: <code>switchOfStuff(4)</code> should have a value of "stuff"
testString: assert(switchOfStuff(4) === "stuff", '<code>switchOfStuff(4)</code> should have a value of "stuff"');
testString: assert(switchOfStuff(4) === "stuff");
- text: You should not use any <code>if</code> or <code>else</code> statements
testString: assert(!/else/g.test(code) || !/if/g.test(code), 'You should not use any <code>if</code> or <code>else</code> statements');
testString: assert(!/else/g.test(code) || !/if/g.test(code));
- text: You should use a <code>default</code> statement
testString: assert(switchOfStuff("string-to-trigger-default-case") === "stuff", 'You should use a <code>default</code> statement');
testString: assert(switchOfStuff("string-to-trigger-default-case") === "stuff");
- text: You should have at least 3 <code>break</code> statements
testString: assert(code.match(/break/g).length > 2, 'You should have at least 3 <code>break</code> statements');
testString: assert(code.match(/break/g).length > 2);
```

View File

@ -21,9 +21,9 @@ Set <code>someAdjective</code> and append it to <code>myStr</code> using the <co
```yml
tests:
- text: <code>someAdjective</code> should be set to a string at least 3 characters long
testString: assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2, '<code>someAdjective</code> should be set to a string at least 3 characters long');
testString: assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2);
- text: Append <code>someAdjective</code> to <code>myStr</code> using the <code>+=</code> operator
testString: assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0, 'Append <code>someAdjective</code> to <code>myStr</code> using the <code>+=</code> operator');
testString: assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0);
```

View File

@ -24,9 +24,9 @@ Call the <code>processArg</code> function with an argument of <code>7</code> and
```yml
tests:
- text: <code>processed</code> should have a value of <code>2</code>
testString: assert(processed === 2, '<code>processed</code> should have a value of <code>2</code>');
testString: assert(processed === 2);
- text: You should assign <code>processArg</code> to <code>processed</code>
testString: assert(/processed\s*=\s*processArg\(\s*7\s*\)\s*;/.test(code), 'You should assign <code>processArg</code> to <code>processed</code>');
testString: assert(/processed\s*=\s*processArg\(\s*7\s*\)\s*;/.test(code));
```

View File

@ -46,15 +46,15 @@ You can set these object properties to whatever values you want, as long <code>"
```yml
tests:
- text: <code>myDog</code> should contain the property <code>name</code> and it should be a <code>string</code>.
testString: assert((function(z){if(z.hasOwnProperty("name") && z.name !== undefined && typeof z.name === "string"){return true;}else{return false;}})(myDog), '<code>myDog</code> should contain the property <code>name</code> and it should be a <code>string</code>.');
testString: assert((function(z){if(z.hasOwnProperty("name") && z.name !== undefined && typeof z.name === "string"){return true;}else{return false;}})(myDog));
- text: <code>myDog</code> should contain the property <code>legs</code> and it should be a <code>number</code>.
testString: assert((function(z){if(z.hasOwnProperty("legs") && z.legs !== undefined && typeof z.legs === "number"){return true;}else{return false;}})(myDog), '<code>myDog</code> should contain the property <code>legs</code> and it should be a <code>number</code>.');
testString: assert((function(z){if(z.hasOwnProperty("legs") && z.legs !== undefined && typeof z.legs === "number"){return true;}else{return false;}})(myDog));
- text: <code>myDog</code> should contain the property <code>tails</code> and it should be a <code>number</code>.
testString: assert((function(z){if(z.hasOwnProperty("tails") && z.tails !== undefined && typeof z.tails === "number"){return true;}else{return false;}})(myDog), '<code>myDog</code> should contain the property <code>tails</code> and it should be a <code>number</code>.');
testString: assert((function(z){if(z.hasOwnProperty("tails") && z.tails !== undefined && typeof z.tails === "number"){return true;}else{return false;}})(myDog));
- text: <code>myDog</code> should contain the property <code>friends</code> and it should be an <code>array</code>.
testString: assert((function(z){if(z.hasOwnProperty("friends") && z.friends !== undefined && Array.isArray(z.friends)){return true;}else{return false;}})(myDog), '<code>myDog</code> should contain the property <code>friends</code> and it should be an <code>array</code>.');
testString: assert((function(z){if(z.hasOwnProperty("friends") && z.friends !== undefined && Array.isArray(z.friends)){return true;}else{return false;}})(myDog));
- text: <code>myDog</code> should only contain all the given properties.
testString: assert((function(z){return Object.keys(z).length === 4;})(myDog), '<code>myDog</code> should only contain all the given properties.');
testString: assert((function(z){return Object.keys(z).length === 4;})(myDog));
```

View File

@ -36,31 +36,31 @@ Write chained <code>if</code>/<code>else if</code> statements to fulfill the fol
```yml
tests:
- text: You should have at least four <code>else</code> statements
testString: assert(code.match(/else/g).length > 3, 'You should have at least four <code>else</code> statements');
testString: assert(code.match(/else/g).length > 3);
- text: You should have at least four <code>if</code> statements
testString: assert(code.match(/if/g).length > 3, 'You should have at least four <code>if</code> statements');
testString: assert(code.match(/if/g).length > 3);
- text: You should have at least one <code>return</code> statement
testString: assert(code.match(/return/g).length >= 1, 'You should have at least one <code>return</code> statement');
testString: assert(code.match(/return/g).length >= 1);
- text: <code>testSize(0)</code> should return "Tiny"
testString: assert(testSize(0) === "Tiny", '<code>testSize(0)</code> should return "Tiny"');
testString: assert(testSize(0) === "Tiny");
- text: <code>testSize(4)</code> should return "Tiny"
testString: assert(testSize(4) === "Tiny", '<code>testSize(4)</code> should return "Tiny"');
testString: assert(testSize(4) === "Tiny");
- text: <code>testSize(5)</code> should return "Small"
testString: assert(testSize(5) === "Small", '<code>testSize(5)</code> should return "Small"');
testString: assert(testSize(5) === "Small");
- text: <code>testSize(8)</code> should return "Small"
testString: assert(testSize(8) === "Small", '<code>testSize(8)</code> should return "Small"');
testString: assert(testSize(8) === "Small");
- text: <code>testSize(10)</code> should return "Medium"
testString: assert(testSize(10) === "Medium", '<code>testSize(10)</code> should return "Medium"');
testString: assert(testSize(10) === "Medium");
- text: <code>testSize(14)</code> should return "Medium"
testString: assert(testSize(14) === "Medium", '<code>testSize(14)</code> should return "Medium"');
testString: assert(testSize(14) === "Medium");
- text: <code>testSize(15)</code> should return "Large"
testString: assert(testSize(15) === "Large", '<code>testSize(15)</code> should return "Large"');
testString: assert(testSize(15) === "Large");
- text: <code>testSize(17)</code> should return "Large"
testString: assert(testSize(17) === "Large", '<code>testSize(17)</code> should return "Large"');
testString: assert(testSize(17) === "Large");
- text: <code>testSize(20)</code> should return "Huge"
testString: assert(testSize(20) === "Huge", '<code>testSize(20)</code> should return "Huge"');
testString: assert(testSize(20) === "Huge");
- text: <code>testSize(25)</code> should return "Huge"
testString: assert(testSize(25) === "Huge", '<code>testSize(25)</code> should return "Huge"');
testString: assert(testSize(25) === "Huge");
```

View File

@ -36,9 +36,9 @@ Try creating one of each type of comment.
```yml
tests:
- text: Create a <code>//</code> style comment that contains at least five letters.
testString: assert(code.match(/(\/\/)...../g), 'Create a <code>//</code> style comment that contains at least five letters.');
testString: assert(code.match(/(\/\/)...../g));
- text: Create a <code>/* */</code> style comment that contains at least five letters.
testString: assert(code.match(/(\/\*)([^\/]{5,})(?=\*\/)/gm), 'Create a <code>/* */</code> style comment that contains at least five letters.');
testString: assert(code.match(/(\/\*)([^\/]{5,})(?=\*\/)/gm));
```

View File

@ -42,13 +42,13 @@ Add the <code>equality operator</code> to the indicated line so that the functio
```yml
tests:
- text: <code>testEqual(10)</code> should return "Not Equal"
testString: assert(testEqual(10) === "Not Equal", '<code>testEqual(10)</code> should return "Not Equal"');
testString: assert(testEqual(10) === "Not Equal");
- text: <code>testEqual(12)</code> should return "Equal"
testString: assert(testEqual(12) === "Equal", '<code>testEqual(12)</code> should return "Equal"');
testString: assert(testEqual(12) === "Equal");
- text: <code>testEqual("12")</code> should return "Equal"
testString: assert(testEqual("12") === "Equal", '<code>testEqual("12")</code> should return "Equal"');
testString: assert(testEqual("12") === "Equal");
- text: You should use the <code>==</code> operator
testString: assert(code.match(/==/g) && !code.match(/===/g), 'You should use the <code>==</code> operator');
testString: assert(code.match(/==/g) && !code.match(/===/g));
```

View File

@ -31,21 +31,21 @@ Add the <code>greater than</code> operator to the indicated lines so that the re
```yml
tests:
- text: <code>testGreaterThan(0)</code> should return "10 or Under"
testString: assert(testGreaterThan(0) === "10 or Under", '<code>testGreaterThan(0)</code> should return "10 or Under"');
testString: assert(testGreaterThan(0) === "10 or Under");
- text: <code>testGreaterThan(10)</code> should return "10 or Under"
testString: assert(testGreaterThan(10) === "10 or Under", '<code>testGreaterThan(10)</code> should return "10 or Under"');
testString: assert(testGreaterThan(10) === "10 or Under");
- text: <code>testGreaterThan(11)</code> should return "Over 10"
testString: assert(testGreaterThan(11) === "Over 10", '<code>testGreaterThan(11)</code> should return "Over 10"');
testString: assert(testGreaterThan(11) === "Over 10");
- text: <code>testGreaterThan(99)</code> should return "Over 10"
testString: assert(testGreaterThan(99) === "Over 10", '<code>testGreaterThan(99)</code> should return "Over 10"');
testString: assert(testGreaterThan(99) === "Over 10");
- text: <code>testGreaterThan(100)</code> should return "Over 10"
testString: assert(testGreaterThan(100) === "Over 10", '<code>testGreaterThan(100)</code> should return "Over 10"');
testString: assert(testGreaterThan(100) === "Over 10");
- text: <code>testGreaterThan(101)</code> should return "Over 100"
testString: assert(testGreaterThan(101) === "Over 100", '<code>testGreaterThan(101)</code> should return "Over 100"');
testString: assert(testGreaterThan(101) === "Over 100");
- text: <code>testGreaterThan(150)</code> should return "Over 100"
testString: assert(testGreaterThan(150) === "Over 100", '<code>testGreaterThan(150)</code> should return "Over 100"');
testString: assert(testGreaterThan(150) === "Over 100");
- text: You should use the <code>&gt;</code> operator at least twice
testString: assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1, 'You should use the <code>&gt;</code> operator at least twice');
testString: assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1);
```

View File

@ -31,21 +31,21 @@ Add the <code>greater than or equal to</code> operator to the indicated lines so
```yml
tests:
- text: <code>testGreaterOrEqual(0)</code> should return "Less than 10"
testString: assert(testGreaterOrEqual(0) === "Less than 10", '<code>testGreaterOrEqual(0)</code> should return "Less than 10"');
testString: assert(testGreaterOrEqual(0) === "Less than 10");
- text: <code>testGreaterOrEqual(9)</code> should return "Less than 10"
testString: assert(testGreaterOrEqual(9) === "Less than 10", '<code>testGreaterOrEqual(9)</code> should return "Less than 10"');
testString: assert(testGreaterOrEqual(9) === "Less than 10");
- text: <code>testGreaterOrEqual(10)</code> should return "10 or Over"
testString: assert(testGreaterOrEqual(10) === "10 or Over", '<code>testGreaterOrEqual(10)</code> should return "10 or Over"');
testString: assert(testGreaterOrEqual(10) === "10 or Over");
- text: <code>testGreaterOrEqual(11)</code> should return "10 or Over"
testString: assert(testGreaterOrEqual(11) === "10 or Over", '<code>testGreaterOrEqual(11)</code> should return "10 or Over"');
testString: assert(testGreaterOrEqual(11) === "10 or Over");
- text: <code>testGreaterOrEqual(19)</code> should return "10 or Over"
testString: assert(testGreaterOrEqual(19) === "10 or Over", '<code>testGreaterOrEqual(19)</code> should return "10 or Over"');
testString: assert(testGreaterOrEqual(19) === "10 or Over");
- text: <code>testGreaterOrEqual(100)</code> should return "20 or Over"
testString: assert(testGreaterOrEqual(100) === "20 or Over", '<code>testGreaterOrEqual(100)</code> should return "20 or Over"');
testString: assert(testGreaterOrEqual(100) === "20 or Over");
- text: <code>testGreaterOrEqual(21)</code> should return "20 or Over"
testString: assert(testGreaterOrEqual(21) === "20 or Over", '<code>testGreaterOrEqual(21)</code> should return "20 or Over"');
testString: assert(testGreaterOrEqual(21) === "20 or Over");
- text: You should use the <code>&gt;=</code> operator at least twice
testString: assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1, 'You should use the <code>&gt;=</code> operator at least twice');
testString: assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1);
```

View File

@ -31,17 +31,17 @@ Add the inequality operator <code>!=</code> in the <code>if</code> statement so
```yml
tests:
- text: <code>testNotEqual(99)</code> should return "Equal"
testString: assert(testNotEqual(99) === "Equal", '<code>testNotEqual(99)</code> should return "Equal"');
testString: assert(testNotEqual(99) === "Equal");
- text: <code>testNotEqual("99")</code> should return "Equal"
testString: assert(testNotEqual("99") === "Equal", '<code>testNotEqual("99")</code> should return "Equal"');
testString: assert(testNotEqual("99") === "Equal");
- text: <code>testNotEqual(12)</code> should return "Not Equal"
testString: assert(testNotEqual(12) === "Not Equal", '<code>testNotEqual(12)</code> should return "Not Equal"');
testString: assert(testNotEqual(12) === "Not Equal");
- text: <code>testNotEqual("12")</code> should return "Not Equal"
testString: assert(testNotEqual("12") === "Not Equal", '<code>testNotEqual("12")</code> should return "Not Equal"');
testString: assert(testNotEqual("12") === "Not Equal");
- text: <code>testNotEqual("bob")</code> should return "Not Equal"
testString: assert(testNotEqual("bob") === "Not Equal", '<code>testNotEqual("bob")</code> should return "Not Equal"');
testString: assert(testNotEqual("bob") === "Not Equal");
- text: You should use the <code>!=</code> operator
testString: assert(code.match(/(?!!==)!=/), 'You should use the <code>!=</code> operator');
testString: assert(code.match(/(?!!==)!=/));
```

View File

@ -31,19 +31,19 @@ Add the <code>less than</code> operator to the indicated lines so that the retur
```yml
tests:
- text: <code>testLessThan(0)</code> should return "Under 25"
testString: assert(testLessThan(0) === "Under 25", '<code>testLessThan(0)</code> should return "Under 25"');
testString: assert(testLessThan(0) === "Under 25");
- text: <code>testLessThan(24)</code> should return "Under 25"
testString: assert(testLessThan(24) === "Under 25", '<code>testLessThan(24)</code> should return "Under 25"');
testString: assert(testLessThan(24) === "Under 25");
- text: <code>testLessThan(25)</code> should return "Under 55"
testString: assert(testLessThan(25) === "Under 55", '<code>testLessThan(25)</code> should return "Under 55"');
testString: assert(testLessThan(25) === "Under 55");
- text: <code>testLessThan(54)</code> should return "Under 55"
testString: assert(testLessThan(54) === "Under 55", '<code>testLessThan(54)</code> should return "Under 55"');
testString: assert(testLessThan(54) === "Under 55");
- text: <code>testLessThan(55)</code> should return "55 or Over"
testString: assert(testLessThan(55) === "55 or Over", '<code>testLessThan(55)</code> should return "55 or Over"');
testString: assert(testLessThan(55) === "55 or Over");
- text: <code>testLessThan(99)</code> should return "55 or Over"
testString: assert(testLessThan(99) === "55 or Over", '<code>testLessThan(99)</code> should return "55 or Over"');
testString: assert(testLessThan(99) === "55 or Over");
- text: You should use the <code>&lt;</code> operator at least twice
testString: assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1, 'You should use the <code>&lt;</code> operator at least twice');
testString: assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1);
```

View File

@ -31,21 +31,21 @@ Add the <code>less than or equal to</code> operator to the indicated lines so th
```yml
tests:
- text: <code>testLessOrEqual(0)</code> should return "Smaller Than or Equal to 12"
testString: assert(testLessOrEqual(0) === "Smaller Than or Equal to 12", '<code>testLessOrEqual(0)</code> should return "Smaller Than or Equal to 12"');
testString: assert(testLessOrEqual(0) === "Smaller Than or Equal to 12");
- text: <code>testLessOrEqual(11)</code> should return "Smaller Than or Equal to 12"
testString: assert(testLessOrEqual(11) === "Smaller Than or Equal to 12", '<code>testLessOrEqual(11)</code> should return "Smaller Than or Equal to 12"');
testString: assert(testLessOrEqual(11) === "Smaller Than or Equal to 12");
- text: <code>testLessOrEqual(12)</code> should return "Smaller Than or Equal to 12"
testString: assert(testLessOrEqual(12) === "Smaller Than or Equal to 12", '<code>testLessOrEqual(12)</code> should return "Smaller Than or Equal to 12"');
testString: assert(testLessOrEqual(12) === "Smaller Than or Equal to 12");
- text: <code>testLessOrEqual(23)</code> should return "Smaller Than or Equal to 24"
testString: assert(testLessOrEqual(23) === "Smaller Than or Equal to 24", '<code>testLessOrEqual(23)</code> should return "Smaller Than or Equal to 24"');
testString: assert(testLessOrEqual(23) === "Smaller Than or Equal to 24");
- text: <code>testLessOrEqual(24)</code> should return "Smaller Than or Equal to 24"
testString: assert(testLessOrEqual(24) === "Smaller Than or Equal to 24", '<code>testLessOrEqual(24)</code> should return "Smaller Than or Equal to 24"');
testString: assert(testLessOrEqual(24) === "Smaller Than or Equal to 24");
- text: <code>testLessOrEqual(25)</code> should return "More Than 24"
testString: assert(testLessOrEqual(25) === "More Than 24", '<code>testLessOrEqual(25)</code> should return "More Than 24"');
testString: assert(testLessOrEqual(25) === "More Than 24");
- text: <code>testLessOrEqual(55)</code> should return "More Than 24"
testString: assert(testLessOrEqual(55) === "More Than 24", '<code>testLessOrEqual(55)</code> should return "More Than 24"');
testString: assert(testLessOrEqual(55) === "More Than 24");
- text: You should use the <code>&lt;=</code> operator at least twice
testString: assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1, 'You should use the <code>&lt;=</code> operator at least twice');
testString: assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1);
```

View File

@ -30,13 +30,13 @@ Use the strict equality operator in the <code>if</code> statement so the functio
```yml
tests:
- text: <code>testStrict(10)</code> should return "Not Equal"
testString: assert(testStrict(10) === "Not Equal", '<code>testStrict(10)</code> should return "Not Equal"');
testString: assert(testStrict(10) === "Not Equal");
- text: <code>testStrict(7)</code> should return "Equal"
testString: assert(testStrict(7) === "Equal", '<code>testStrict(7)</code> should return "Equal"');
testString: assert(testStrict(7) === "Equal");
- text: <code>testStrict("7")</code> should return "Not Equal"
testString: assert(testStrict("7") === "Not Equal", '<code>testStrict("7")</code> should return "Not Equal"');
testString: assert(testStrict("7") === "Not Equal");
- text: You should use the <code>===</code> operator
testString: assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0, 'You should use the <code>===</code> operator');
testString: assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0);
```

View File

@ -29,15 +29,15 @@ Add the <code>strict inequality operator</code> to the <code>if</code> statement
```yml
tests:
- text: <code>testStrictNotEqual(17)</code> should return "Equal"
testString: assert(testStrictNotEqual(17) === "Equal", '<code>testStrictNotEqual(17)</code> should return "Equal"');
testString: assert(testStrictNotEqual(17) === "Equal");
- text: <code>testStrictNotEqual("17")</code> should return "Not Equal"
testString: assert(testStrictNotEqual("17") === "Not Equal", '<code>testStrictNotEqual("17")</code> should return "Not Equal"');
testString: assert(testStrictNotEqual("17") === "Not Equal");
- text: <code>testStrictNotEqual(12)</code> should return "Not Equal"
testString: assert(testStrictNotEqual(12) === "Not Equal", '<code>testStrictNotEqual(12)</code> should return "Not Equal"');
testString: assert(testStrictNotEqual(12) === "Not Equal");
- text: <code>testStrictNotEqual("bob")</code> should return "Not Equal"
testString: assert(testStrictNotEqual("bob") === "Not Equal", '<code>testStrictNotEqual("bob")</code> should return "Not Equal"');
testString: assert(testStrictNotEqual("bob") === "Not Equal");
- text: You should use the <code>!==</code> operator
testString: assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0, 'You should use the <code>!==</code> operator');
testString: assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0);
```

View File

@ -41,25 +41,25 @@ Combine the two if statements into one statement which will return <code>"Yes"</
```yml
tests:
- text: You should use the <code>&&</code> operator once
testString: assert(code.match(/&&/g).length === 1, 'You should use the <code>&&</code> operator once');
testString: assert(code.match(/&&/g).length === 1);
- text: You should only have one <code>if</code> statement
testString: assert(code.match(/if/g).length === 1, 'You should only have one <code>if</code> statement');
testString: assert(code.match(/if/g).length === 1);
- text: <code>testLogicalAnd(0)</code> should return "No"
testString: assert(testLogicalAnd(0) === "No", '<code>testLogicalAnd(0)</code> should return "No"');
testString: assert(testLogicalAnd(0) === "No");
- text: <code>testLogicalAnd(24)</code> should return "No"
testString: assert(testLogicalAnd(24) === "No", '<code>testLogicalAnd(24)</code> should return "No"');
testString: assert(testLogicalAnd(24) === "No");
- text: <code>testLogicalAnd(25)</code> should return "Yes"
testString: assert(testLogicalAnd(25) === "Yes", '<code>testLogicalAnd(25)</code> should return "Yes"');
testString: assert(testLogicalAnd(25) === "Yes");
- text: <code>testLogicalAnd(30)</code> should return "Yes"
testString: assert(testLogicalAnd(30) === "Yes", '<code>testLogicalAnd(30)</code> should return "Yes"');
testString: assert(testLogicalAnd(30) === "Yes");
- text: <code>testLogicalAnd(50)</code> should return "Yes"
testString: assert(testLogicalAnd(50) === "Yes", '<code>testLogicalAnd(50)</code> should return "Yes"');
testString: assert(testLogicalAnd(50) === "Yes");
- text: <code>testLogicalAnd(51)</code> should return "No"
testString: assert(testLogicalAnd(51) === "No", '<code>testLogicalAnd(51)</code> should return "No"');
testString: assert(testLogicalAnd(51) === "No");
- text: <code>testLogicalAnd(75)</code> should return "No"
testString: assert(testLogicalAnd(75) === "No", '<code>testLogicalAnd(75)</code> should return "No"');
testString: assert(testLogicalAnd(75) === "No");
- text: <code>testLogicalAnd(80)</code> should return "No"
testString: assert(testLogicalAnd(80) === "No", '<code>testLogicalAnd(80)</code> should return "No"');
testString: assert(testLogicalAnd(80) === "No");
```

View File

@ -43,25 +43,25 @@ Combine the two <code>if</code> statements into one statement which returns <cod
```yml
tests:
- text: You should use the <code>||</code> operator once
testString: assert(code.match(/\|\|/g).length === 1, 'You should use the <code>||</code> operator once');
testString: assert(code.match(/\|\|/g).length === 1);
- text: You should only have one <code>if</code> statement
testString: assert(code.match(/if/g).length === 1, 'You should only have one <code>if</code> statement');
testString: assert(code.match(/if/g).length === 1);
- text: <code>testLogicalOr(0)</code> should return "Outside"
testString: assert(testLogicalOr(0) === "Outside", '<code>testLogicalOr(0)</code> should return "Outside"');
testString: assert(testLogicalOr(0) === "Outside");
- text: <code>testLogicalOr(9)</code> should return "Outside"
testString: assert(testLogicalOr(9) === "Outside", '<code>testLogicalOr(9)</code> should return "Outside"');
testString: assert(testLogicalOr(9) === "Outside");
- text: <code>testLogicalOr(10)</code> should return "Inside"
testString: assert(testLogicalOr(10) === "Inside", '<code>testLogicalOr(10)</code> should return "Inside"');
testString: assert(testLogicalOr(10) === "Inside");
- text: <code>testLogicalOr(15)</code> should return "Inside"
testString: assert(testLogicalOr(15) === "Inside", '<code>testLogicalOr(15)</code> should return "Inside"');
testString: assert(testLogicalOr(15) === "Inside");
- text: <code>testLogicalOr(19)</code> should return "Inside"
testString: assert(testLogicalOr(19) === "Inside", '<code>testLogicalOr(19)</code> should return "Inside"');
testString: assert(testLogicalOr(19) === "Inside");
- text: <code>testLogicalOr(20)</code> should return "Inside"
testString: assert(testLogicalOr(20) === "Inside", '<code>testLogicalOr(20)</code> should return "Inside"');
testString: assert(testLogicalOr(20) === "Inside");
- text: <code>testLogicalOr(21)</code> should return "Outside"
testString: assert(testLogicalOr(21) === "Outside", '<code>testLogicalOr(21)</code> should return "Outside"');
testString: assert(testLogicalOr(21) === "Outside");
- text: <code>testLogicalOr(25)</code> should return "Outside"
testString: assert(testLogicalOr(25) === "Outside", '<code>testLogicalOr(25)</code> should return "Outside"');
testString: assert(testLogicalOr(25) === "Outside");
```

View File

@ -31,15 +31,15 @@ Convert the assignments for <code>a</code>, <code>b</code>, and <code>c</code> t
```yml
tests:
- text: <code>a</code> should equal <code>15</code>
testString: assert(a === 15, '<code>a</code> should equal <code>15</code>');
testString: assert(a === 15);
- text: <code>b</code> should equal <code>26</code>
testString: assert(b === 26, '<code>b</code> should equal <code>26</code>');
testString: assert(b === 26);
- text: <code>c</code> should equal <code>19</code>
testString: assert(c === 19, '<code>c</code> should equal <code>19</code>');
testString: assert(c === 19);
- text: You should use the <code>+=</code> operator for each variable
testString: assert(code.match(/\+=/g).length === 3, 'You should use the <code>+=</code> operator for each variable');
testString: assert(code.match(/\+=/g).length === 3);
- text: Do not modify the code above the line
testString: assert(/var a = 3;/.test(code) && /var b = 17;/.test(code) && /var c = 12;/.test(code), 'Do not modify the code above the line');
testString: assert(/var a = 3;/.test(code) && /var b = 17;/.test(code) && /var c = 12;/.test(code));
```

View File

@ -24,15 +24,15 @@ Convert the assignments for <code>a</code>, <code>b</code>, and <code>c</code> t
```yml
tests:
- text: <code>a</code> should equal <code>4</code>
testString: assert(a === 4, '<code>a</code> should equal <code>4</code>');
testString: assert(a === 4);
- text: <code>b</code> should equal <code>27</code>
testString: assert(b === 27, '<code>b</code> should equal <code>27</code>');
testString: assert(b === 27);
- text: <code>c</code> should equal <code>3</code>
testString: assert(c === 3, '<code>c</code> should equal <code>3</code>');
testString: assert(c === 3);
- text: You should use the <code>/=</code> operator for each variable
testString: assert(code.match(/\/=/g).length === 3, 'You should use the <code>/=</code> operator for each variable');
testString: assert(code.match(/\/=/g).length === 3);
- text: Do not modify the code above the line
testString: assert(/var a = 48;/.test(code) && /var b = 108;/.test(code) && /var c = 33;/.test(code), 'Do not modify the code above the line');
testString: assert(/var a = 48;/.test(code) && /var b = 108;/.test(code) && /var c = 33;/.test(code));
```

View File

@ -24,15 +24,15 @@ Convert the assignments for <code>a</code>, <code>b</code>, and <code>c</code> t
```yml
tests:
- text: <code>a</code> should equal <code>25</code>
testString: assert(a === 25, '<code>a</code> should equal <code>25</code>');
testString: assert(a === 25);
- text: <code>b</code> should equal <code>36</code>
testString: assert(b === 36, '<code>b</code> should equal <code>36</code>');
testString: assert(b === 36);
- text: <code>c</code> should equal <code>46</code>
testString: assert(c === 46, '<code>c</code> should equal <code>46</code>');
testString: assert(c === 46);
- text: You should use the <code>*=</code> operator for each variable
testString: assert(code.match(/\*=/g).length === 3, 'You should use the <code>*=</code> operator for each variable');
testString: assert(code.match(/\*=/g).length === 3);
- text: Do not modify the code above the line
testString: assert(/var a = 5;/.test(code) && /var b = 12;/.test(code) && /var c = 4\.6;/.test(code), 'Do not modify the code above the line');
testString: assert(/var a = 5;/.test(code) && /var b = 12;/.test(code) && /var c = 4\.6;/.test(code));
```

View File

@ -24,15 +24,15 @@ Convert the assignments for <code>a</code>, <code>b</code>, and <code>c</code> t
```yml
tests:
- text: <code>a</code> should equal <code>5</code>
testString: assert(a === 5, '<code>a</code> should equal <code>5</code>');
testString: assert(a === 5);
- text: <code>b</code> should equal <code>-6</code>
testString: assert(b === -6, '<code>b</code> should equal <code>-6</code>');
testString: assert(b === -6);
- text: <code>c</code> should equal <code>2</code>
testString: assert(c === 2, '<code>c</code> should equal <code>2</code>');
testString: assert(c === 2);
- text: You should use the <code>-=</code> operator for each variable
testString: assert(code.match(/-=/g).length === 3, 'You should use the <code>-=</code> operator for each variable');
testString: assert(code.match(/-=/g).length === 3);
- text: Do not modify the code above the line
testString: assert(/var a = 11;/.test(code) && /var b = 9;/.test(code) && /var c = 3;/.test(code), 'Do not modify the code above the line');
testString: assert(/var a = 11;/.test(code) && /var b = 9;/.test(code) && /var c = 3;/.test(code));
```

View File

@ -28,13 +28,13 @@ Build <code>myStr</code> from the strings <code>"This is the start. "</code> and
```yml
tests:
- text: <code>myStr</code> should have a value of <code>This is the start. This is the end.</code>
testString: assert(myStr === "This is the start. This is the end.", '<code>myStr</code> should have a value of <code>This is the start. This is the end.</code>');
testString: assert(myStr === "This is the start. This is the end.");
- text: Use the <code>+</code> operator to build <code>myStr</code>
testString: assert(code.match(/(["']).*(["'])\s*\+\s*(["']).*(["'])/g).length > 1, 'Use the <code>+</code> operator to build <code>myStr</code>');
testString: assert(code.match(/(["']).*(["'])\s*\+\s*(["']).*(["'])/g).length > 1);
- text: <code>myStr</code> should be created using the <code>var</code> keyword.
testString: assert(/var\s+myStr/.test(code), '<code>myStr</code> should be created using the <code>var</code> keyword.');
testString: assert(/var\s+myStr/.test(code));
- text: Make sure to assign the result to the <code>myStr</code> variable.
testString: assert(/myStr\s*=/.test(code), 'Make sure to assign the result to the <code>myStr</code> variable.');
testString: assert(/myStr\s*=/.test(code));
```

View File

@ -22,9 +22,9 @@ Build <code>myStr</code> over several lines by concatenating these two strings:
```yml
tests:
- text: <code>myStr</code> should have a value of <code>This is the first sentence. This is the second sentence.</code>
testString: assert(myStr === "This is the first sentence. This is the second sentence.", '<code>myStr</code> should have a value of <code>This is the first sentence. This is the second sentence.</code>');
testString: assert(myStr === "This is the first sentence. This is the second sentence.");
- text: Use the <code>+=</code> operator to build <code>myStr</code>
testString: assert(code.match(/\w\s*\+=\s*["']/g).length > 1 && code.match(/\w\s*\=\s*["']/g).length > 1, 'Use the <code>+=</code> operator to build <code>myStr</code>');
testString: assert(code.match(/\w\s*\+=\s*["']/g).length > 1 && code.match(/\w\s*\=\s*["']/g).length > 1);
```

View File

@ -21,9 +21,9 @@ Set <code>myName</code> to a string equal to your name and build <code>myStr</co
```yml
tests:
- text: <code>myName</code> should be set to a string at least 3 characters long
testString: assert(typeof myName !== 'undefined' && myName.length > 2, '<code>myName</code> should be set to a string at least 3 characters long');
testString: assert(typeof myName !== 'undefined' && myName.length > 2);
- text: Use two <code>+</code> operators to build <code>myStr</code> with <code>myName</code> inside it
testString: assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0, 'Use two <code>+</code> operators to build <code>myStr</code> with <code>myName</code> inside it');
testString: assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0);
```

View File

@ -33,11 +33,11 @@ Push the odd numbers from 9 through 1 to <code>myArray</code> using a <code>for<
```yml
tests:
- text: You should be using a <code>for</code> loop for this.
testString: assert(code.match(/for\s*\(/g).length > 1, 'You should be using a <code>for</code> loop for this.');
testString: assert(code.match(/for\s*\(/g).length > 1);
- text: You should be using the array method <code>push</code>.
testString: assert(code.match(/myArray.push/), 'You should be using the array method <code>push</code>.');
testString: assert(code.match(/myArray.push/));
- text: <code>myArray</code> should equal <code>[9,7,5,3,1]</code>.
testString: assert.deepEqual(myArray, [9,7,5,3,1], '<code>myArray</code> should equal <code>[9,7,5,3,1]</code>.');
testString: assert.deepEqual(myArray, [9,7,5,3,1]);
```

View File

@ -26,19 +26,19 @@ You will write a card counting function. It will receive a <code>card</code> par
```yml
tests:
- text: Cards Sequence 2, 3, 4, 5, 6 should return <code>5 Bet</code>
testString: assert((function(){ count = 0; cc(2);cc(3);cc(4);cc(5);var out = cc(6); if(out === "5 Bet") {return true;} return false; })(), 'Cards Sequence 2, 3, 4, 5, 6 should return <code>5 Bet</code>');
testString: assert((function(){ count = 0; cc(2);cc(3);cc(4);cc(5);var out = cc(6); if(out === "5 Bet") {return true;} return false; })());
- text: Cards Sequence 7, 8, 9 should return <code>0 Hold</code>
testString: assert((function(){ count = 0; cc(7);cc(8);var out = cc(9); if(out === "0 Hold") {return true;} return false; })(), 'Cards Sequence 7, 8, 9 should return <code>0 Hold</code>');
testString: assert((function(){ count = 0; cc(7);cc(8);var out = cc(9); if(out === "0 Hold") {return true;} return false; })());
- text: Cards Sequence 10, J, Q, K, A should return <code>-5 Hold</code>
testString: assert((function(){ count = 0; cc(10);cc('J');cc('Q');cc('K');var out = cc('A'); if(out === "-5 Hold") {return true;} return false; })(), 'Cards Sequence 10, J, Q, K, A should return <code>-5 Hold</code>');
testString: assert((function(){ count = 0; cc(10);cc('J');cc('Q');cc('K');var out = cc('A'); if(out === "-5 Hold") {return true;} return false; })());
- text: Cards Sequence 3, 7, Q, 8, A should return <code>-1 Hold</code>
testString: assert((function(){ count = 0; cc(3);cc(7);cc('Q');cc(8);var out = cc('A'); if(out === "-1 Hold") {return true;} return false; })(), 'Cards Sequence 3, 7, Q, 8, A should return <code>-1 Hold</code>');
testString: assert((function(){ count = 0; cc(3);cc(7);cc('Q');cc(8);var out = cc('A'); if(out === "-1 Hold") {return true;} return false; })());
- text: Cards Sequence 2, J, 9, 2, 7 should return <code>1 Bet</code>
testString: assert((function(){ count = 0; cc(2);cc('J');cc(9);cc(2);var out = cc(7); if(out === "1 Bet") {return true;} return false; })(), 'Cards Sequence 2, J, 9, 2, 7 should return <code>1 Bet</code>');
testString: assert((function(){ count = 0; cc(2);cc('J');cc(9);cc(2);var out = cc(7); if(out === "1 Bet") {return true;} return false; })());
- text: Cards Sequence 2, 2, 10 should return <code>1 Bet</code>
testString: assert((function(){ count = 0; cc(2);cc(2);var out = cc(10); if(out === "1 Bet") {return true;} return false; })(), 'Cards Sequence 2, 2, 10 should return <code>1 Bet</code>');
testString: assert((function(){ count = 0; cc(2);cc(2);var out = cc(10); if(out === "1 Bet") {return true;} return false; })());
- text: Cards Sequence 3, 2, A, 10, K should return <code>-1 Hold</code>
testString: assert((function(){ count = 0; cc(3);cc(2);cc('A');cc(10);var out = cc('K'); if(out === "-1 Hold") {return true;} return false; })(), 'Cards Sequence 3, 2, A, 10, K should return <code>-1 Hold</code>');
testString: assert((function(){ count = 0; cc(3);cc(2);cc('A');cc(10);var out = cc('K'); if(out === "-1 Hold") {return true;} return false; })());
```

View File

@ -22,9 +22,9 @@ Create a variable <code>myDecimal</code> and give it a decimal value with a frac
```yml
tests:
- text: <code>myDecimal</code> should be a number.
testString: assert(typeof myDecimal === "number", '<code>myDecimal</code> should be a number.');
testString: assert(typeof myDecimal === "number");
- text: <code>myDecimal</code> should have a decimal point
testString: assert(myDecimal % 1 != 0, '<code>myDecimal</code> should have a decimal point');
testString: assert(myDecimal % 1 != 0);
```

View File

@ -33,7 +33,7 @@ Use the <code>var</code> keyword to create a variable called <code>myName</code>
```yml
tests:
- text: You should declare <code>myName</code> with the <code>var</code> keyword, ending with a semicolon
testString: assert(/var\s+myName\s*;/.test(code), 'You should declare <code>myName</code> with the <code>var</code> keyword, ending with a semicolon');
testString: assert(/var\s+myName\s*;/.test(code));
```

View File

@ -23,9 +23,9 @@ Create two new <code>string</code> variables: <code>myFirstName</code> and <code
```yml
tests:
- text: <code>myFirstName</code> should be a string with at least one character in it.
testString: assert((function(){if(typeof myFirstName !== "undefined" && typeof myFirstName === "string" && myFirstName.length > 0){return true;}else{return false;}})(), '<code>myFirstName</code> should be a string with at least one character in it.');
testString: assert((function(){if(typeof myFirstName !== "undefined" && typeof myFirstName === "string" && myFirstName.length > 0){return true;}else{return false;}})());
- text: <code>myLastName</code> should be a string with at least one character in it.
testString: assert((function(){if(typeof myLastName !== "undefined" && typeof myLastName === "string" && myLastName.length > 0){return true;}else{return false;}})(), '<code>myLastName</code> should be a string with at least one character in it.');
testString: assert((function(){if(typeof myLastName !== "undefined" && typeof myLastName === "string" && myLastName.length > 0){return true;}else{return false;}})());
```

View File

@ -25,13 +25,13 @@ Change the code to use the <code>--</code> operator on <code>myVar</code>.
```yml
tests:
- text: <code>myVar</code> should equal <code>10</code>
testString: assert(myVar === 10, '<code>myVar</code> should equal <code>10</code>');
testString: assert(myVar === 10);
- text: <code>myVar = myVar - 1;</code> should be changed
testString: assert(/var\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code), '<code>myVar = myVar - 1;</code> should be changed');
testString: assert(/var\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code));
- text: Use the <code>--</code> operator on <code>myVar</code>
testString: assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code), 'Use the <code>--</code> operator on <code>myVar</code>');
testString: assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code));
- text: Do not change code above the line
testString: assert(/var myVar = 11;/.test(code), 'Do not change code above the line');
testString: assert(/var myVar = 11;/.test(code));
```

View File

@ -22,9 +22,9 @@ Delete the <code>"tails"</code> property from <code>myDog</code>. You may use ei
```yml
tests:
- text: Delete the property <code>"tails"</code> from <code>myDog</code>.
testString: assert(typeof myDog === "object" && myDog.tails === undefined, 'Delete the property <code>"tails"</code> from <code>myDog</code>.');
testString: assert(typeof myDog === "object" && myDog.tails === undefined);
- text: Do not modify the <code>myDog</code> setup
testString: 'assert(code.match(/"tails": 1/g).length > 1, ''Do not modify the <code>myDog</code> setup'');'
testString: 'assert(code.match(/"tails": 1/g).length > 1);'
```

View File

@ -21,11 +21,11 @@ Change the <code>0.0</code> so that <code>quotient</code> will equal to <code>2.
```yml
tests:
- text: The variable <code>quotient</code> should equal <code>2.2</code>
testString: assert(quotient === 2.2, 'The variable <code>quotient</code> should equal <code>2.2</code>');
testString: assert(quotient === 2.2);
- text: You should use the <code>/</code> operator to divide 4.4 by 2
testString: assert(/4\.40*\s*\/\s*2\.*0*/.test(code), 'You should use the <code>/</code> operator to divide 4.4 by 2');
testString: assert(/4\.40*\s*\/\s*2\.*0*/.test(code));
- text: The quotient variable should only be assigned once
testString: assert(code.match(/quotient/g).length === 1, 'The quotient variable should only be assigned once');
testString: assert(code.match(/quotient/g).length === 1);
```

View File

@ -30,9 +30,9 @@ Change the <code>0</code> so that the <code>quotient</code> is equal to <code>2<
```yml
tests:
- text: Make the variable <code>quotient</code> equal to 2.
testString: assert(quotient === 2, 'Make the variable <code>quotient</code> equal to 2.');
testString: assert(quotient === 2);
- text: Use the <code>/</code> operator
testString: assert(/\d+\s*\/\s*\d+/.test(code), 'Use the <code>/</code> operator');
testString: assert(/\d+\s*\/\s*\d+/.test(code));
```

View File

@ -26,9 +26,9 @@ Use <dfn>backslashes</dfn> to assign a string to the <code>myStr</code> variable
```yml
tests:
- text: You should use two double quotes (<code>&quot;</code>) and four escaped double quotes (<code>&#92;&quot;</code>).
testString: assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2, 'You should use two double quotes (<code>&quot;</code>) and four escaped double quotes (<code>&#92;&quot;</code>).');
testString: assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2);
- text: 'Variable myStr should contain the string: <code>I am a "double quoted" string inside "double quotes".</code>'
testString: 'assert(myStr === "I am a \"double quoted\" string inside \"double quotes\".", ''Variable myStr should contain the string: <code>I am a "double quoted" string inside "double quotes".</code>'');'
testString: 'assert(myStr === "I am a \"double quoted\" string inside \"double quotes\".");'
```

View File

@ -26,11 +26,11 @@ Set <code>remainder</code> equal to the remainder of <code>11</code> divided by
```yml
tests:
- text: The variable <code>remainder</code> should be initialized
testString: assert(/var\s+?remainder/.test(code), 'The variable <code>remainder</code> should be initialized');
testString: assert(/var\s+?remainder/.test(code));
- text: The value of <code>remainder</code> should be <code>2</code>
testString: assert(remainder === 2, 'The value of <code>remainder</code> should be <code>2</code>');
testString: assert(remainder === 2);
- text: You should use the <code>%</code> operator
testString: assert(/\s+?remainder\s*?=\s*?.*%.*;/.test(code), 'You should use the <code>%</code> operator');
testString: assert(/\s+?remainder\s*?=\s*?.*%.*;/.test(code));
```

View File

@ -23,11 +23,11 @@ Change <code>randomFraction</code> to return a random number instead of returnin
```yml
tests:
- text: <code>randomFraction</code> should return a random number.
testString: assert(typeof randomFraction() === "number", '<code>randomFraction</code> should return a random number.');
testString: assert(typeof randomFraction() === "number");
- text: The number returned by <code>randomFraction</code> should be a decimal.
testString: assert((randomFraction()+''). match(/\./g), 'The number returned by <code>randomFraction</code> should be a decimal.');
testString: assert((randomFraction()+''). match(/\./g));
- text: You should be using <code>Math.random</code> to generate the random decimal number.
testString: assert(code.match(/Math\.random/g).length >= 0, 'You should be using <code>Math.random</code> to generate the random decimal number.');
testString: assert(code.match(/Math\.random/g).length >= 0);
```

View File

@ -26,13 +26,13 @@ Use this technique to generate and return a random whole number between <code>0<
```yml
tests:
- text: The result of <code>randomWholeNum</code> should be a whole number.
testString: assert(typeof randomWholeNum() === "number" && (function(){var r = randomWholeNum();return Math.floor(r) === r;})(), 'The result of <code>randomWholeNum</code> should be a whole number.');
testString: assert(typeof randomWholeNum() === "number" && (function(){var r = randomWholeNum();return Math.floor(r) === r;})());
- text: You should be using <code>Math.random</code> to generate a random number.
testString: assert(code.match(/Math.random/g).length > 1, 'You should be using <code>Math.random</code> to generate a random number.');
testString: assert(code.match(/Math.random/g).length > 1);
- text: You should have multiplied the result of <code>Math.random</code> by 10 to make it a number that is between zero and nine.
testString: assert(code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g), 'You should have multiplied the result of <code>Math.random</code> by 10 to make it a number that is between zero and nine.');
testString: assert(code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g));
- text: You should use <code>Math.floor</code> to remove the decimal part of the number.
testString: assert(code.match(/Math.floor/g).length > 1, 'You should use <code>Math.floor</code> to remove the decimal part of the number.');
testString: assert(code.match(/Math.floor/g).length > 1);
```

View File

@ -24,13 +24,13 @@ Create a function called <code>randomRange</code> that takes a range <code>myMin
```yml
tests:
- text: The lowest random number that can be generated by <code>randomRange</code> should be equal to your minimum number, <code>myMin</code>.
testString: assert(calcMin === 5, 'The lowest random number that can be generated by <code>randomRange</code> should be equal to your minimum number, <code>myMin</code>.');
testString: assert(calcMin === 5);
- text: The highest random number that can be generated by <code>randomRange</code> should be equal to your maximum number, <code>myMax</code>.
testString: assert(calcMax === 15, 'The highest random number that can be generated by <code>randomRange</code> should be equal to your maximum number, <code>myMax</code>.');
testString: assert(calcMax === 15);
- text: The random number generated by <code>randomRange</code> should be an integer, not a decimal.
testString: assert(randomRange(0,1) % 1 === 0 , 'The random number generated by <code>randomRange</code> should be an integer, not a decimal.');
testString: assert(randomRange(0,1) % 1 === 0 );
- text: <code>randomRange</code> should use both <code>myMax</code> and <code>myMin</code>, and return a random number in your range.
testString: assert((function(){if(code.match(/myMax/g).length > 1 && code.match(/myMin/g).length > 2 && code.match(/Math.floor/g) && code.match(/Math.random/g)){return true;}else{return false;}})(), '<code>randomRange</code> should use both <code>myMax</code> and <code>myMin</code>, and return a random number in your range.');
testString: assert((function(){if(code.match(/myMax/g).length > 1 && code.match(/myMin/g).length > 2 && code.match(/Math.floor/g) && code.match(/Math.random/g)){return true;}else{return false;}})());
```

View File

@ -23,13 +23,13 @@ Inside function <code>fun1</code>, assign <code>5</code> to <code>oopsGlobal</co
```yml
tests:
- text: <code>myGlobal</code> should be defined
testString: assert(typeof myGlobal != "undefined", '<code>myGlobal</code> should be defined');
testString: assert(typeof myGlobal != "undefined");
- text: <code>myGlobal</code> should have a value of <code>10</code>
testString: assert(myGlobal === 10, '<code>myGlobal</code> should have a value of <code>10</code>');
testString: assert(myGlobal === 10);
- text: <code>myGlobal</code> should be declared using the <code>var</code> keyword
testString: assert(/var\s+myGlobal/.test(code), '<code>myGlobal</code> should be declared using the <code>var</code> keyword');
testString: assert(/var\s+myGlobal/.test(code));
- text: <code>oopsGlobal</code> should be a global variable and have a value of <code>5</code>
testString: assert(typeof oopsGlobal != "undefined" && oopsGlobal === 5, '<code>oopsGlobal</code> should be a global variable and have a value of <code>5</code>');
testString: assert(typeof oopsGlobal != "undefined" && oopsGlobal === 5);
```

View File

@ -32,11 +32,11 @@ Add a local variable to <code>myOutfit</code> function to override the value of
```yml
tests:
- text: Do not change the value of the global <code>outerWear</code>
testString: assert(outerWear === "T-Shirt", 'Do not change the value of the global <code>outerWear</code>');
testString: assert(outerWear === "T-Shirt");
- text: <code>myOutfit</code> should return <code>"sweater"</code>
testString: assert(myOutfit() === "sweater", '<code>myOutfit</code> should return <code>"sweater"</code>');
testString: assert(myOutfit() === "sweater");
- text: Do not change the return statement
testString: assert(/return outerWear/.test(code), 'Do not change the return statement');
testString: assert(/return outerWear/.test(code));
```

View File

@ -24,27 +24,27 @@ Your function will be passed <code>par</code> and <code>strokes</code> arguments
```yml
tests:
- text: <code>golfScore(4, 1)</code> should return "Hole-in-one!"
testString: assert(golfScore(4, 1) === "Hole-in-one!", '<code>golfScore(4, 1)</code> should return "Hole-in-one!"');
testString: assert(golfScore(4, 1) === "Hole-in-one!");
- text: <code>golfScore(4, 2)</code> should return "Eagle"
testString: assert(golfScore(4, 2) === "Eagle", '<code>golfScore(4, 2)</code> should return "Eagle"');
testString: assert(golfScore(4, 2) === "Eagle");
- text: <code>golfScore(5, 2)</code> should return "Eagle"
testString: assert(golfScore(5, 2) === "Eagle", '<code>golfScore(5, 2)</code> should return "Eagle"');
testString: assert(golfScore(5, 2) === "Eagle");
- text: <code>golfScore(4, 3)</code> should return "Birdie"
testString: assert(golfScore(4, 3) === "Birdie", '<code>golfScore(4, 3)</code> should return "Birdie"');
testString: assert(golfScore(4, 3) === "Birdie");
- text: <code>golfScore(4, 4)</code> should return "Par"
testString: assert(golfScore(4, 4) === "Par", '<code>golfScore(4, 4)</code> should return "Par"');
testString: assert(golfScore(4, 4) === "Par");
- text: <code>golfScore(1, 1)</code> should return "Hole-in-one!"
testString: assert(golfScore(1, 1) === "Hole-in-one!", '<code>golfScore(1, 1)</code> should return "Hole-in-one!"');
testString: assert(golfScore(1, 1) === "Hole-in-one!");
- text: <code>golfScore(5, 5)</code> should return "Par"
testString: assert(golfScore(5, 5) === "Par", '<code>golfScore(5, 5)</code> should return "Par"');
testString: assert(golfScore(5, 5) === "Par");
- text: <code>golfScore(4, 5)</code> should return "Bogey"
testString: assert(golfScore(4, 5) === "Bogey", '<code>golfScore(4, 5)</code> should return "Bogey"');
testString: assert(golfScore(4, 5) === "Bogey");
- text: <code>golfScore(4, 6)</code> should return "Double Bogey"
testString: assert(golfScore(4, 6) === "Double Bogey", '<code>golfScore(4, 6)</code> should return "Double Bogey"');
testString: assert(golfScore(4, 6) === "Double Bogey");
- text: <code>golfScore(4, 7)</code> should return "Go Home!"
testString: assert(golfScore(4, 7) === "Go Home!", '<code>golfScore(4, 7)</code> should return "Go Home!"');
testString: assert(golfScore(4, 7) === "Go Home!");
- text: <code>golfScore(5, 9)</code> should return "Go Home!"
testString: assert(golfScore(5, 9) === "Go Home!", '<code>golfScore(5, 9)</code> should return "Go Home!"');
testString: assert(golfScore(5, 9) === "Go Home!");
```

View File

@ -26,13 +26,13 @@ Change the code to use the <code>++</code> operator on <code>myVar</code>.
```yml
tests:
- text: <code>myVar</code> should equal <code>88</code>
testString: assert(myVar === 88, '<code>myVar</code> should equal <code>88</code>');
testString: assert(myVar === 88);
- text: <code>myVar = myVar + 1;</code> should be changed
testString: assert(/var\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2});/.test(code), '<code>myVar = myVar + 1;</code> should be changed');
testString: assert(/var\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2});/.test(code));
- text: Use the <code>++</code> operator
testString: assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code), 'Use the <code>++</code> operator');
testString: assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code));
- text: Do not change code above the line
testString: assert(/var myVar = 87;/.test(code), 'Do not change code above the line');
testString: assert(/var myVar = 87;/.test(code));
```

View File

@ -23,7 +23,7 @@ Define a variable <code>a</code> with <code>var</code> and initialize it to a va
```yml
tests:
- text: Initialize <code>a</code> to a value of <code>9</code>
testString: assert(/var\s+a\s*=\s*9\s*/.test(code), 'Initialize <code>a</code> to a value of <code>9</code>');
testString: assert(/var\s+a\s*=\s*9\s*/.test(code));
```

View File

@ -32,21 +32,21 @@ Convert the logic to use <code>else if</code> statements.
```yml
tests:
- text: You should have at least two <code>else</code> statements
testString: assert(code.match(/else/g).length > 1, 'You should have at least two <code>else</code> statements');
testString: assert(code.match(/else/g).length > 1);
- text: You should have at least two <code>if</code> statements
testString: assert(code.match(/if/g).length > 1, 'You should have at least two <code>if</code> statements');
- text: You should have closing and opening curly braces for each condition
testString: assert(code.match(/if\s*\((.+)\)\s*\{[\s\S]+\}\s*else if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/), 'You should have closing and opening curly braces for each condition in your if else statement');
testString: assert(code.match(/if/g).length > 1);
- text: You should have closing and opening curly braces for each <code>if else</code> code block.
testString: assert(code.match(/if\s*\((.+)\)\s*\{[\s\S]+\}\s*else if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/));
- text: <code>testElseIf(0)</code> should return "Smaller than 5"
testString: assert(testElseIf(0) === "Smaller than 5", '<code>testElseIf(0)</code> should return "Smaller than 5"');
testString: assert(testElseIf(0) === "Smaller than 5");
- text: <code>testElseIf(5)</code> should return "Between 5 and 10"
testString: assert(testElseIf(5) === "Between 5 and 10", '<code>testElseIf(5)</code> should return "Between 5 and 10"');
testString: assert(testElseIf(5) === "Between 5 and 10");
- text: <code>testElseIf(7)</code> should return "Between 5 and 10"
testString: assert(testElseIf(7) === "Between 5 and 10", '<code>testElseIf(7)</code> should return "Between 5 and 10"');
testString: assert(testElseIf(7) === "Between 5 and 10");
- text: <code>testElseIf(10)</code> should return "Between 5 and 10"
testString: assert(testElseIf(10) === "Between 5 and 10", '<code>testElseIf(10)</code> should return "Between 5 and 10"');
testString: assert(testElseIf(10) === "Between 5 and 10");
- text: <code>testElseIf(12)</code> should return "Greater than 10"
testString: assert(testElseIf(12) === "Greater than 10", '<code>testElseIf(12)</code> should return "Greater than 10"');
testString: assert(testElseIf(12) === "Greater than 10");
```

View File

@ -30,19 +30,19 @@ Combine the <code>if</code> statements into a single <code>if/else</code> statem
```yml
tests:
- text: You should only have one <code>if</code> statement in the editor
testString: assert(code.match(/if/g).length === 1, 'You should only have one <code>if</code> statement in the editor');
testString: assert(code.match(/if/g).length === 1);
- text: You should use an <code>else</code> statement
testString: assert(/else/g.test(code), 'You should use an <code>else</code> statement');
testString: assert(/else/g.test(code));
- text: <code>testElse(4)</code> should return "5 or Smaller"
testString: assert(testElse(4) === "5 or Smaller", '<code>testElse(4)</code> should return "5 or Smaller"');
testString: assert(testElse(4) === "5 or Smaller");
- text: <code>testElse(5)</code> should return "5 or Smaller"
testString: assert(testElse(5) === "5 or Smaller", '<code>testElse(5)</code> should return "5 or Smaller"');
testString: assert(testElse(5) === "5 or Smaller");
- text: <code>testElse(6)</code> should return "Bigger than 5"
testString: assert(testElse(6) === "Bigger than 5", '<code>testElse(6)</code> should return "Bigger than 5"');
testString: assert(testElse(6) === "Bigger than 5");
- text: <code>testElse(10)</code> should return "Bigger than 5"
testString: assert(testElse(10) === "Bigger than 5", '<code>testElse(10)</code> should return "Bigger than 5"');
testString: assert(testElse(10) === "Bigger than 5");
- text: Do not change the code above or below the lines.
testString: assert(/var result = "";/.test(code) && /return result;/.test(code), 'Do not change the code above or below the lines.');
testString: assert(/var result = "";/.test(code) && /return result;/.test(code));
```

View File

@ -32,9 +32,9 @@ Push the odd numbers from 1 through 9 to <code>myArray</code> using a <code>for<
```yml
tests:
- text: You should be using a <code>for</code> loop for this.
testString: assert(code.match(/for\s*\(/g).length > 1, 'You should be using a <code>for</code> loop for this.');
testString: assert(code.match(/for\s*\(/g).length > 1);
- text: <code>myArray</code> should equal <code>[1,3,5,7,9]</code>.
testString: assert.deepEqual(myArray, [1,3,5,7,9], '<code>myArray</code> should equal <code>[1,3,5,7,9]</code>.');
testString: assert.deepEqual(myArray, [1,3,5,7,9]);
```

View File

@ -58,11 +58,11 @@ Change the <code>while</code> loop in the code to a <code>do...while</code> loop
```yml
tests:
- text: You should be using a <code>do...while</code> loop for this exercise.
testString: assert(code.match(/do/g), 'You should be using a <code>do...while</code> loop for this exercise.');
testString: assert(code.match(/do/g));
- text: <code>myArray</code> should equal <code>[10]</code>.
testString: assert.deepEqual(myArray, [10], '<code>myArray</code> should equal <code>[10]</code>.');
testString: assert.deepEqual(myArray, [10]);
- text: <code>i</code> should equal <code>11</code>
testString: assert.equal(i, 11, '<code>i</code> should equal <code>11</code>');
testString: assert.equal(i, 11);
```
</section>

View File

@ -37,9 +37,9 @@ Use a <code>for</code> loop to work to push the values 1 through 5 onto <code>my
```yml
tests:
- text: You should be using a <code>for</code> loop for this.
testString: assert(code.match(/for\s*\(/g).length > 1, 'You should be using a <code>for</code> loop for this.');
testString: assert(code.match(/for\s*\(/g).length > 1);
- text: <code>myArray</code> should equal <code>[1,2,3,4,5]</code>.
testString: assert.deepEqual(myArray, [1,2,3,4,5], '<code>myArray</code> should equal <code>[1,2,3,4,5]</code>.');
testString: assert.deepEqual(myArray, [1,2,3,4,5]);
```

View File

@ -33,9 +33,9 @@ Push the numbers 0 through 4 to <code>myArray</code> using a <code>while</code>
```yml
tests:
- text: You should be using a <code>while</code> loop for this.
testString: assert(code.match(/while/g), 'You should be using a <code>while</code> loop for this.');
testString: assert(code.match(/while/g));
- text: <code>myArray</code> should equal <code>[0,1,2,3,4]</code>.
testString: assert.deepEqual(myArray, [0,1,2,3,4], '<code>myArray</code> should equal <code>[0,1,2,3,4]</code>.');
testString: assert.deepEqual(myArray, [0,1,2,3,4]);
```

View File

@ -34,9 +34,9 @@ Declare a local variable <code>myVar</code> inside <code>myLocalScope</code>. Ru
```yml
tests:
- text: No global <code>myVar</code> variable
testString: assert(typeof myVar === 'undefined', 'No global <code>myVar</code> variable');
testString: assert(typeof myVar === 'undefined');
- text: Add a local <code>myVar</code> variable
testString: assert(/function\s+myLocalScope\s*\(\s*\)\s*\{\s[\s\S]+\s*var\s*myVar\s*(\s*|=[\s\S]+)\s*;[\s\S]+}/.test(code), 'Add a local <code>myVar</code> variable');
testString: assert(/function\s+myLocalScope\s*\(\s*\)\s*\{\s[\s\S]+\s*var\s*myVar\s*(\s*|=[\s\S]+)\s*;[\s\S]+}/.test(code));
```

View File

@ -58,11 +58,11 @@ Change the order of logic in the function so that it will return the correct sta
```yml
tests:
- text: <code>orderMyLogic(4)</code> should return "Less than 5"
testString: assert(orderMyLogic(4) === "Less than 5", '<code>orderMyLogic(4)</code> should return "Less than 5"');
testString: assert(orderMyLogic(4) === "Less than 5");
- text: <code>orderMyLogic(6)</code> should return "Less than 10"
testString: assert(orderMyLogic(6) === "Less than 10", '<code>orderMyLogic(6)</code> should return "Less than 10"');
testString: assert(orderMyLogic(6) === "Less than 10");
- text: <code>orderMyLogic(11)</code> should return "Greater than or equal to 10"
testString: assert(orderMyLogic(11) === "Greater than or equal to 10", '<code>orderMyLogic(11)</code> should return "Greater than or equal to 10"');
testString: assert(orderMyLogic(11) === "Greater than or equal to 10");
```

View File

@ -31,11 +31,11 @@ Use the <code>.pop()</code> function to remove the last item from <code>myArray<
```yml
tests:
- text: <code>myArray</code> should only contain <code>[["John", 23]]</code>.
testString: assert((function(d){if(d[0][0] == 'John' && d[0][1] === 23 && d[1] == undefined){return true;}else{return false;}})(myArray), '<code>myArray</code> should only contain <code>[["John", 23]]</code>.');
testString: assert((function(d){if(d[0][0] == 'John' && d[0][1] === 23 && d[1] == undefined){return true;}else{return false;}})(myArray));
- text: Use <code>pop()</code> on <code>myArray</code>
testString: assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code), 'Use <code>pop()</code> on <code>myArray</code>');
testString: assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code));
- text: <code>removedFromMyArray</code> should only contain <code>["cat", 2]</code>.
testString: assert((function(d){if(d[0] == 'cat' && d[1] === 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray), '<code>removedFromMyArray</code> should only contain <code>["cat", 2]</code>.');
testString: assert((function(d){if(d[0] == 'cat' && d[1] === 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray));
```

View File

@ -29,7 +29,7 @@ Push <code>["dog", 3]</code> onto the end of the <code>myArray</code> variable.
```yml
tests:
- text: <code>myArray</code> should now equal <code>[["John", 23], ["cat", 2], ["dog", 3]]</code>.
testString: assert((function(d){if(d[2] != undefined && d[0][0] == 'John' && d[0][1] === 23 && d[2][0] == 'dog' && d[2][1] === 3 && d[2].length == 2){return true;}else{return false;}})(myArray), '<code>myArray</code> should now equal <code>[["John", 23], ["cat", 2], ["dog", 3]]</code>.');
testString: assert((function(d){if(d[2] != undefined && d[0][0] == 'John' && d[0][1] === 23 && d[2][0] == 'dog' && d[2][1] === 3 && d[2].length == 2){return true;}else{return false;}})(myArray));
```

View File

@ -22,9 +22,9 @@ Use the <code>.shift()</code> function to remove the first item from <code>myArr
```yml
tests:
- text: <code>myArray</code> should now equal <code>[["dog", 3]]</code>.
testString: assert((function(d){if(d[0][0] == 'dog' && d[0][1] === 3 && d[1] == undefined){return true;}else{return false;}})(myArray), '<code>myArray</code> should now equal <code>[["dog", 3]]</code>.');
testString: assert((function(d){if(d[0][0] == 'dog' && d[0][1] === 3 && d[1] == undefined){return true;}else{return false;}})(myArray));
- text: <code>removedFromMyArray</code> should contain <code>["John", 23]</code>.
testString: assert((function(d){if(d[0] == 'John' && d[1] === 23 && typeof removedFromMyArray === 'object'){return true;}else{return false;}})(removedFromMyArray), '<code>removedFromMyArray</code> should contain <code>["John", 23]</code>.');
testString: assert((function(d){if(d[0] == 'John' && d[1] === 23 && typeof removedFromMyArray === 'object'){return true;}else{return false;}})(removedFromMyArray));
```

View File

@ -22,7 +22,7 @@ Add <code>["Paul",35]</code> to the beginning of the <code>myArray</code> variab
```yml
tests:
- text: <code>myArray</code> should now have [["Paul", 35], ["dog", 3]].
testString: assert((function(d){if(typeof d[0] === "object" && d[0][0] == 'Paul' && d[0][1] === 35 && d[1][0] != undefined && d[1][0] == 'dog' && d[1][1] != undefined && d[1][1] == 3){return true;}else{return false;}})(myArray), '<code>myArray</code> should now have [["Paul", 35], ["dog", 3]].');
testString: assert((function(d){if(typeof d[0] === "object" && d[0][0] == 'Paul' && d[0][1] === 35 && d[1][0] != undefined && d[1][0] == 'dog' && d[1][1] != undefined && d[1][1] == 3){return true;}else{return false;}})(myArray));
```

View File

@ -58,23 +58,23 @@ Add a new album to the <code>myMusic</code> array. Add <code>artist</code> and <
```yml
tests:
- text: <code>myMusic</code> should be an array
testString: assert(Array.isArray(myMusic), '<code>myMusic</code> should be an array');
testString: assert(Array.isArray(myMusic));
- text: <code>myMusic</code> should have at least two elements
testString: assert(myMusic.length > 1, '<code>myMusic</code> should have at least two elements');
testString: assert(myMusic.length > 1);
- text: <code>myMusic[1]</code> should be an object
testString: assert(typeof myMusic[1] === 'object', '<code>myMusic[1]</code> should be an object');
testString: assert(typeof myMusic[1] === 'object');
- text: <code>myMusic[1]</code> should have at least 4 properties
testString: assert(Object.keys(myMusic[1]).length > 3, '<code>myMusic[1]</code> should have at least 4 properties');
testString: assert(Object.keys(myMusic[1]).length > 3);
- text: <code>myMusic[1]</code> should contain an <code>artist</code> property which is a string
testString: assert(myMusic[1].hasOwnProperty('artist') && typeof myMusic[1].artist === 'string', '<code>myMusic[1]</code> should contain an <code>artist</code> property which is a string');
testString: assert(myMusic[1].hasOwnProperty('artist') && typeof myMusic[1].artist === 'string');
- text: <code>myMusic[1]</code> should contain a <code>title</code> property which is a string
testString: assert(myMusic[1].hasOwnProperty('title') && typeof myMusic[1].title === 'string', '<code>myMusic[1]</code> should contain a <code>title</code> property which is a string');
testString: assert(myMusic[1].hasOwnProperty('title') && typeof myMusic[1].title === 'string');
- text: <code>myMusic[1]</code> should contain a <code>release_year</code> property which is a number
testString: assert(myMusic[1].hasOwnProperty('release_year') && typeof myMusic[1].release_year === 'number', '<code>myMusic[1]</code> should contain a <code>release_year</code> property which is a number');
testString: assert(myMusic[1].hasOwnProperty('release_year') && typeof myMusic[1].release_year === 'number');
- text: <code>myMusic[1]</code> should contain a <code>formats</code> property which is an array
testString: assert(myMusic[1].hasOwnProperty('formats') && Array.isArray(myMusic[1].formats), '<code>myMusic[1]</code> should contain a <code>formats</code> property which is an array');
testString: assert(myMusic[1].hasOwnProperty('formats') && Array.isArray(myMusic[1].formats));
- text: <code>formats</code> should be an array of strings with at least two elements
testString: assert(myMusic[1].formats.every(function(item) { return (typeof item === "string")}) && myMusic[1].formats.length > 1, '<code>formats</code> should be an array of strings with at least two elements');
testString: assert(myMusic[1].formats.every(function(item) { return (typeof item === "string")}) && myMusic[1].formats.length > 1);
```

View File

@ -29,9 +29,9 @@ Modify the data stored at index <code>0</code> of <code>myArray</code> to a valu
```yml
tests:
- text: <code>myArray</code> should now be [45,64,99].
testString: assert((function(){if(typeof myArray != 'undefined' && myArray[0] == 45 && myArray[1] == 64 && myArray[2] == 99){return true;}else{return false;}})(), '<code>myArray</code> should now be [45,64,99].');
testString: assert((function(){if(typeof myArray != 'undefined' && myArray[0] == 45 && myArray[1] == 64 && myArray[2] == 99){return true;}else{return false;}})());
- text: You should be using correct index to modify the value in <code>myArray</code>.
testString: assert((function(){if(code.match(/myArray\[0\]\s*=\s*/g)){return true;}else{return false;}})(), 'You should be using correct index to modify the value in <code>myArray</code>.');
testString: assert((function(){if(code.match(/myArray\[0\]\s*=\s*/g)){return true;}else{return false;}})());
```

View File

@ -36,27 +36,27 @@ Write a switch statement to set <code>answer</code> for the following ranges:<br
```yml
tests:
- text: <code>sequentialSizes(1)</code> should return "Low"
testString: assert(sequentialSizes(1) === "Low", '<code>sequentialSizes(1)</code> should return "Low"');
testString: assert(sequentialSizes(1) === "Low");
- text: <code>sequentialSizes(2)</code> should return "Low"
testString: assert(sequentialSizes(2) === "Low", '<code>sequentialSizes(2)</code> should return "Low"');
testString: assert(sequentialSizes(2) === "Low");
- text: <code>sequentialSizes(3)</code> should return "Low"
testString: assert(sequentialSizes(3) === "Low", '<code>sequentialSizes(3)</code> should return "Low"');
testString: assert(sequentialSizes(3) === "Low");
- text: <code>sequentialSizes(4)</code> should return "Mid"
testString: assert(sequentialSizes(4) === "Mid", '<code>sequentialSizes(4)</code> should return "Mid"');
testString: assert(sequentialSizes(4) === "Mid");
- text: <code>sequentialSizes(5)</code> should return "Mid"
testString: assert(sequentialSizes(5) === "Mid", '<code>sequentialSizes(5)</code> should return "Mid"');
testString: assert(sequentialSizes(5) === "Mid");
- text: <code>sequentialSizes(6)</code> should return "Mid"
testString: assert(sequentialSizes(6) === "Mid", '<code>sequentialSizes(6)</code> should return "Mid"');
testString: assert(sequentialSizes(6) === "Mid");
- text: <code>sequentialSizes(7)</code> should return "High"
testString: assert(sequentialSizes(7) === "High", '<code>sequentialSizes(7)</code> should return "High"');
testString: assert(sequentialSizes(7) === "High");
- text: <code>sequentialSizes(8)</code> should return "High"
testString: assert(sequentialSizes(8) === "High", '<code>sequentialSizes(8)</code> should return "High"');
testString: assert(sequentialSizes(8) === "High");
- text: <code>sequentialSizes(9)</code> should return "High"
testString: assert(sequentialSizes(9) === "High", '<code>sequentialSizes(9)</code> should return "High"');
testString: assert(sequentialSizes(9) === "High");
- text: You should not use any <code>if</code> or <code>else</code> statements
testString: assert(!/else/g.test(code) || !/if/g.test(code), 'You should not use any <code>if</code> or <code>else</code> statements');
testString: assert(!/else/g.test(code) || !/if/g.test(code));
- text: You should have nine <code>case</code> statements
testString: assert(code.match(/case/g).length === 9, 'You should have nine <code>case</code> statements');
testString: assert(code.match(/case/g).length === 9);
```

View File

@ -22,9 +22,9 @@ Change the <code>0.0</code> so that product will equal <code>5.0</code>.
```yml
tests:
- text: The variable <code>product</code> should equal <code>5.0</code>.
testString: assert(product === 5.0, 'The variable <code>product</code> should equal <code>5.0</code>.');
testString: assert(product === 5.0);
- text: You should use the <code>*</code> operator
testString: assert(/\*/.test(code), 'You should use the <code>*</code> operator');
testString: assert(/\*/.test(code));
```

View File

@ -30,9 +30,9 @@ Change the <code>0</code> so that product will equal <code>80</code>.
```yml
tests:
- text: Make the variable <code>product</code> equal 80
testString: assert(product === 80,'Make the variable <code>product</code> equal 80');
testString: assert(product === 80);
- text: Use the <code>*</code> operator
testString: assert(/\*/.test(code), 'Use the <code>*</code> operator');
testString: assert(/\*/.test(code));
```

View File

@ -21,7 +21,7 @@ Create a nested array called <code>myArray</code>.
```yml
tests:
- text: <code>myArray</code> should have at least one array nested within another array.
testString: assert(Array.isArray(myArray) && myArray.some(Array.isArray), '<code>myArray</code> should have at least one array nested within another array.');
testString: assert(Array.isArray(myArray) && myArray.some(Array.isArray));
```

View File

@ -34,11 +34,11 @@ Modify function <code>multiplyAll</code> so that it multiplies the <code>product
```yml
tests:
- text: <code>multiplyAll([[1],[2],[3]])</code> should return <code>6</code>
testString: assert(multiplyAll([[1],[2],[3]]) === 6, '<code>multiplyAll([[1],[2],[3]])</code> should return <code>6</code>');
testString: assert(multiplyAll([[1],[2],[3]]) === 6);
- text: <code>multiplyAll([[1,2],[3,4],[5,6,7]])</code> should return <code>5040</code>
testString: assert(multiplyAll([[1,2],[3,4],[5,6,7]]) === 5040, '<code>multiplyAll([[1,2],[3,4],[5,6,7]])</code> should return <code>5040</code>');
testString: assert(multiplyAll([[1,2],[3,4],[5,6,7]]) === 5040);
- text: <code>multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])</code> should return <code>54</code>
testString: assert(multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]) === 54, '<code>multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])</code> should return <code>54</code>');
testString: assert(multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]) === 54);
```

View File

@ -32,13 +32,13 @@ We have passed two arguments, <code>"Hello"</code> and <code>"World"</code>. Ins
```yml
tests:
- text: <code>functionWithArgs</code> should be a function
testString: assert(typeof functionWithArgs === 'function', '<code>functionWithArgs</code> should be a function');
testString: assert(typeof functionWithArgs === 'function');
- text: <code>functionWithArgs(1,2)</code> should output <code>3</code>
testString: if(typeof functionWithArgs === "function") { capture(); functionWithArgs(1,2); uncapture(); } assert(logOutput == 3, '<code>functionWithArgs(1,2)</code> should output <code>3</code>');
testString: if(typeof functionWithArgs === "function") { capture(); functionWithArgs(1,2); uncapture(); } assert(logOutput == 3);
- text: <code>functionWithArgs(7,9)</code> should output <code>16</code>
testString: if(typeof functionWithArgs === "function") { capture(); functionWithArgs(7,9); uncapture(); } assert(logOutput == 16, '<code>functionWithArgs(7,9)</code> should output <code>16</code>');
testString: if(typeof functionWithArgs === "function") { capture(); functionWithArgs(7,9); uncapture(); } assert(logOutput == 16);
- text: Call <code>functionWithArgs</code> with two numbers after you define it.
testString: assert(/^\s*functionWithArgs\s*\(\s*\d+\s*,\s*\d+\s*\)\s*;/m.test(code), 'Call <code>functionWithArgs</code> with two numbers after you define it.');
testString: assert(/^\s*functionWithArgs\s*\(\s*\d+\s*,\s*\d+\s*\)\s*;/m.test(code));
```

View File

@ -36,11 +36,11 @@ The <code>compareEquality</code> function in the editor compares two values usin
```yml
tests:
- text: <code>compareEquality(10, "10")</code> should return "Not Equal"
testString: assert(compareEquality(10, "10") === "Not Equal", '<code>compareEquality(10, "10")</code> should return "Not Equal"');
testString: assert(compareEquality(10, "10") === "Not Equal");
- text: <code>compareEquality("20", 20)</code> should return "Not Equal"
testString: assert(compareEquality("20", 20) === "Not Equal", '<code>compareEquality("20", 20)</code> should return "Not Equal"');
testString: assert(compareEquality("20", 20) === "Not Equal");
- text: You should use the <code>===</code> operator
testString: assert(code.match(/===/g), 'You should use the <code>===</code> operator');
testString: assert(code.match(/===/g));
```

View File

@ -28,15 +28,15 @@ tests:
- text: <code>"Kristian", "lastName"</code> should return <code>"Vos"</code>
testString: assert(lookUpProfile('Kristian','lastName') === "Vos", '<code>"Kristian", "lastName"</code> should return <code>"Vos"</code>');
- text: <code>"Sherlock", "likes"</code> should return <code>["Intriguing Cases", "Violin"]</code>
testString: assert.deepEqual(lookUpProfile("Sherlock", "likes"), ["Intriguing Cases", "Violin"], '<code>"Sherlock", "likes"</code> should return <code>["Intriguing Cases", "Violin"]</code>');
testString: assert.deepEqual(lookUpProfile("Sherlock", "likes"), ["Intriguing Cases", "Violin"]);
- text: <code>"Harry","likes"</code> should return an array
testString: assert(typeof lookUpProfile("Harry", "likes") === "object", '<code>"Harry","likes"</code> should return an array');
testString: assert(typeof lookUpProfile("Harry", "likes") === "object");
- text: <code>"Bob", "number"</code> should return "No such contact"
testString: assert(lookUpProfile("Bob", "number") === "No such contact", '<code>"Bob", "number"</code> should return "No such contact"');
testString: assert(lookUpProfile("Bob", "number") === "No such contact");
- text: <code>"Bob", "potato"</code> should return "No such contact"
testString: assert(lookUpProfile("Bob", "potato") === "No such contact", '<code>"Bob", "potato"</code> should return "No such contact"');
testString: assert(lookUpProfile("Bob", "potato") === "No such contact");
- text: <code>"Akira", "address"</code> should return "No such property"
testString: assert(lookUpProfile("Akira", "address") === "No such property", '<code>"Akira", "address"</code> should return "No such property"');
testString: assert(lookUpProfile("Akira", "address") === "No such property");
```

View File

@ -43,9 +43,9 @@ Right now, the <code>&#60;a&#62;</code> tag in the string uses double quotes eve
```yml
tests:
- text: Remove all the <code>backslashes</code> (<code>\</code>)
testString: assert(!/\\/g.test(code) && myStr.match('\\s*<a href\\s*=\\s*"http://www.example.com"\\s*target\\s*=\\s*"_blank">\\s*Link\\s*</a>\\s*'), 'Remove all the <code>backslashes</code> (<code>\</code>)');
testString: assert(!/\\/g.test(code) && myStr.match('\\s*<a href\\s*=\\s*"http://www.example.com"\\s*target\\s*=\\s*"_blank">\\s*Link\\s*</a>\\s*'));
- text: You should have two single quotes <code>&#39;</code> and four double quotes <code>&quot;</code>
testString: assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2, 'You should have two single quotes <code>&#39;</code> and four double quotes <code>&quot;</code>');
testString: assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2);
```

View File

@ -47,25 +47,25 @@ Change the chained <code>if</code>/<code>else if</code> statements into a <code>
```yml
tests:
- text: You should not use any <code>else</code> statements anywhere in the editor
testString: assert(!/else/g.test(code), 'You should not use any <code>else</code> statements anywhere in the editor');
testString: assert(!/else/g.test(code));
- text: You should not use any <code>if</code> statements anywhere in the editor
testString: assert(!/if/g.test(code), 'You should not use any <code>if</code> statements anywhere in the editor');
testString: assert(!/if/g.test(code));
- text: You should have at least four <code>break</code> statements
testString: assert(code.match(/break/g).length >= 4, 'You should have at least four <code>break</code> statements');
testString: assert(code.match(/break/g).length >= 4);
- text: <code>chainToSwitch("bob")</code> should be "Marley"
testString: assert(chainToSwitch("bob") === "Marley", '<code>chainToSwitch("bob")</code> should be "Marley"');
testString: assert(chainToSwitch("bob") === "Marley");
- text: <code>chainToSwitch(42)</code> should be "The Answer"
testString: assert(chainToSwitch(42) === "The Answer", '<code>chainToSwitch(42)</code> should be "The Answer"');
testString: assert(chainToSwitch(42) === "The Answer");
- text: "<code>chainToSwitch(1)</code> should be \"There is no #1\""
testString: "assert(chainToSwitch(1) === \"There is no #1\", '<code>chainToSwitch(1)</code> should be \"There is no #1\"');"
testString: "assert(chainToSwitch(1) === \"There is no #1\");"
- text: <code>chainToSwitch(99)</code> should be "Missed me by this much!"
testString: assert(chainToSwitch(99) === "Missed me by this much!", '<code>chainToSwitch(99)</code> should be "Missed me by this much!"');
testString: assert(chainToSwitch(99) === "Missed me by this much!");
- text: <code>chainToSwitch(7)</code> should be "Ate Nine"
testString: assert(chainToSwitch(7) === "Ate Nine", '<code>chainToSwitch(7)</code> should be "Ate Nine"');
testString: assert(chainToSwitch(7) === "Ate Nine");
- text: <code>chainToSwitch("John")</code> should be "" (empty string)
testString: assert(chainToSwitch("John") === "", '<code>chainToSwitch("John")</code> should be "" (empty string)');
testString: assert(chainToSwitch("John") === "");
- text: <code>chainToSwitch(156)</code> should be "" (empty string)
testString: assert(chainToSwitch(156) === "", '<code>chainToSwitch(156)</code> should be "" (empty string)');
testString: assert(chainToSwitch(156) === "");
```

View File

@ -31,13 +31,13 @@ Create a function <code>timesFive</code> that accepts one argument, multiplies i
```yml
tests:
- text: <code>timesFive</code> should be a function
testString: assert(typeof timesFive === 'function', '<code>timesFive</code> should be a function');
testString: assert(typeof timesFive === 'function');
- text: <code>timesFive(5)</code> should return <code>25</code>
testString: assert(timesFive(5) === 25, '<code>timesFive(5)</code> should return <code>25</code>');
testString: assert(timesFive(5) === 25);
- text: <code>timesFive(2)</code> should return <code>10</code>
testString: assert(timesFive(2) === 10, '<code>timesFive(2)</code> should return <code>10</code>');
testString: assert(timesFive(2) === 10);
- text: <code>timesFive(0)</code> should return <code>0</code>
testString: assert(timesFive(0) === 0, '<code>timesFive(0)</code> should return <code>0</code>');
testString: assert(timesFive(0) === 0);
```

View File

@ -34,17 +34,17 @@ Modify the function <code>abTest</code> so that if <code>a</code> or <code>b</co
```yml
tests:
- text: <code>abTest(2,2)</code> should return a number
testString: assert(typeof abTest(2,2) === 'number' , '<code>abTest(2,2)</code> should return a number');
testString: assert(typeof abTest(2,2) === 'number' );
- text: <code>abTest(2,2)</code> should return <code>8</code>
testString: assert(abTest(2,2) === 8 , '<code>abTest(2,2)</code> should return <code>8</code>');
testString: assert(abTest(2,2) === 8 );
- text: <code>abTest(-2,2)</code> should return <code>undefined</code>
testString: assert(abTest(-2,2) === undefined , '<code>abTest(-2,2)</code> should return <code>undefined</code>');
testString: assert(abTest(-2,2) === undefined );
- text: <code>abTest(2,-2)</code> should return <code>undefined</code>
testString: assert(abTest(2,-2) === undefined , '<code>abTest(2,-2)</code> should return <code>undefined</code>');
testString: assert(abTest(2,-2) === undefined );
- text: <code>abTest(2,8)</code> should return <code>18</code>
testString: assert(abTest(2,8) === 18 , '<code>abTest(2,8)</code> should return <code>18</code>');
testString: assert(abTest(2,8) === 18 );
- text: <code>abTest(3,3)</code> should return <code>12</code>
testString: assert(abTest(3,3) === 12 , '<code>abTest(3,3)</code> should return <code>12</code>');
testString: assert(abTest(3,3) === 12 );
```

View File

@ -41,11 +41,11 @@ Fix the function <code>isLess</code> to remove the <code>if/else</code> statemen
```yml
tests:
- text: <code>isLess(10,15)</code> should return <code>true</code>
testString: assert(isLess(10,15) === true, '<code>isLess(10,15)</code> should return <code>true</code>');
testString: assert(isLess(10,15) === true);
- text: <code>isLess(15,10)</code> should return <code>false</code>
testString: assert(isLess(15, 10) === false, '<code>isLess(15,10)</code> should return <code>false</code>');
testString: assert(isLess(15, 10) === false);
- text: You should not use any <code>if</code> or <code>else</code> statements
testString: assert(!/if|else/g.test(code), 'You should not use any <code>if</code> or <code>else</code> statements');
testString: assert(!/if|else/g.test(code));
```

View File

@ -39,17 +39,17 @@ Write a switch statement which tests <code>val</code> and sets <code>answer</cod
```yml
tests:
- text: <code>caseInSwitch(1)</code> should have a value of "alpha"
testString: assert(caseInSwitch(1) === "alpha", '<code>caseInSwitch(1)</code> should have a value of "alpha"');
testString: assert(caseInSwitch(1) === "alpha");
- text: <code>caseInSwitch(2)</code> should have a value of "beta"
testString: assert(caseInSwitch(2) === "beta", '<code>caseInSwitch(2)</code> should have a value of "beta"');
testString: assert(caseInSwitch(2) === "beta");
- text: <code>caseInSwitch(3)</code> should have a value of "gamma"
testString: assert(caseInSwitch(3) === "gamma", '<code>caseInSwitch(3)</code> should have a value of "gamma"');
testString: assert(caseInSwitch(3) === "gamma");
- text: <code>caseInSwitch(4)</code> should have a value of "delta"
testString: assert(caseInSwitch(4) === "delta", '<code>caseInSwitch(4)</code> should have a value of "delta"');
testString: assert(caseInSwitch(4) === "delta");
- text: You should not use any <code>if</code> or <code>else</code> statements
testString: assert(!/else/g.test(code) || !/if/g.test(code), 'You should not use any <code>if</code> or <code>else</code> statements');
testString: assert(!/else/g.test(code) || !/if/g.test(code));
- text: You should have at least 3 <code>break</code> statements
testString: assert(code.match(/break/g).length > 2, 'You should have at least 3 <code>break</code> statements');
testString: assert(code.match(/break/g).length > 2);
```

View File

@ -24,13 +24,13 @@ There should be at least 5 sub-arrays in the list.
```yml
tests:
- text: <code>myList</code> should be an array
testString: assert(isArray, '<code>myList</code> should be an array');
testString: assert(isArray);
- text: The first elements in each of your sub-arrays must all be strings
testString: assert(hasString, 'The first elements in each of your sub-arrays must all be strings');
testString: assert(hasString);
- text: The second elements in each of your sub-arrays must all be numbers
testString: assert(hasNumber, 'The second elements in each of your sub-arrays must all be numbers');
testString: assert(hasNumber);
- text: You must have at least 5 items in your list
testString: assert(count > 4, 'You must have at least 5 items in your list');
testString: assert(count > 4);
```

View File

@ -24,15 +24,15 @@ The <code>nextInLine</code> function should then return the element that was rem
```yml
tests:
- text: <code>nextInLine([], 5)</code> should return a number.
testString: assert.isNumber(nextInLine([],5), '<code>nextInLine([], 5)</code> should return a number.');
testString: assert.isNumber(nextInLine([],5));
- text: <code>nextInLine([], 1)</code> should return <code>1</code>
testString: assert(nextInLine([],1) === 1, '<code>nextInLine([], 1)</code> should return <code>1</code>');
testString: assert(nextInLine([],1) === 1);
- text: <code>nextInLine([2], 1)</code> should return <code>2</code>
testString: assert(nextInLine([2],1) === 2, '<code>nextInLine([2], 1)</code> should return <code>2</code>');
testString: assert(nextInLine([2],1) === 2);
- text: <code>nextInLine([5,6,7,8,9], 1)</code> should return <code>5</code>
testString: assert(nextInLine([5,6,7,8,9],1) === 5, '<code>nextInLine([5,6,7,8,9], 1)</code> should return <code>5</code>');
testString: assert(nextInLine([5,6,7,8,9],1) === 5);
- text: After <code>nextInLine(testArr, 10)</code>, <code>testArr[4]</code> should be <code>10</code>
testString: nextInLine(testArr, 10); assert(testArr[4] === 10, 'After <code>nextInLine(testArr, 10)</code>, <code>testArr[4]</code> should be <code>10</code>');
testString: nextInLine(testArr, 10); assert(testArr[4] === 10);
```

View File

@ -24,11 +24,11 @@ Modify the new array <code>myArray</code> so that it contains both a <code>strin
```yml
tests:
- text: <code>myArray</code> should be an <code>array</code>.
testString: assert(typeof myArray == 'object', '<code>myArray</code> should be an <code>array</code>.');
testString: assert(typeof myArray == 'object');
- text: The first item in <code>myArray</code> should be a <code>string</code>.
testString: assert(typeof myArray[0] !== 'undefined' && typeof myArray[0] == 'string', 'The first item in <code>myArray</code> should be a <code>string</code>.');
testString: assert(typeof myArray[0] !== 'undefined' && typeof myArray[0] == 'string');
- text: The second item in <code>myArray</code> should be a <code>number</code>.
testString: assert(typeof myArray[1] !== 'undefined' && typeof myArray[1] == 'number', 'The second item in <code>myArray</code> should be a <code>number</code>.');
testString: assert(typeof myArray[1] !== 'undefined' && typeof myArray[1] == 'number');
```

View File

@ -32,13 +32,13 @@ Assign the contents of <code>a</code> to variable <code>b</code>.
```yml
tests:
- text: Do not change code above the line
testString: assert(/var a;/.test(code) && /var b = 2;/.test(code), 'Do not change code above the line');
testString: assert(/var a;/.test(code) && /var b = 2;/.test(code));
- text: <code>a</code> should have a value of 7
testString: assert(typeof a === 'number' && a === 7, '<code>a</code> should have a value of 7');
testString: assert(typeof a === 'number' && a === 7);
- text: <code>b</code> should have a value of 7
testString: assert(typeof b === 'number' && b === 7, '<code>b</code> should have a value of 7');
testString: assert(typeof b === 'number' && b === 7);
- text: <code>a</code> should be assigned to <code>b</code> with <code>=</code>
testString: assert(/b\s*=\s*a\s*;/g.test(code), '<code>a</code> should be assigned to <code>b</code> with <code>=</code>');
testString: assert(/b\s*=\s*a\s*;/g.test(code));
```

View File

@ -30,9 +30,9 @@ Change the <code>0</code> so the difference is <code>12</code>.
```yml
tests:
- text: Make the variable <code>difference</code> equal 12.
testString: assert(difference === 12, 'Make the variable <code>difference</code> equal 12.');
testString: assert(difference === 12);
- text: Only subtract one number from 45.
testString: assert(/var\s*difference\s*=\s*45\s*-\s*[0-9]*;(?!\s*[a-zA-Z0-9]+)/.test(code),'Only subtract one number from 45.');
testString: assert(/var\s*difference\s*=\s*45\s*-\s*[0-9]*;(?!\s*[a-zA-Z0-9]+)/.test(code));
```

View File

@ -32,11 +32,11 @@ Modify the function <code>checkObj</code> to test <code>myObj</code> for <code>c
```yml
tests:
- text: <code>checkObj("gift")</code> should return <code>"pony"</code>.
testString: assert(checkObj("gift") === "pony", '<code>checkObj("gift")</code> should return <code>"pony"</code>.');
testString: assert(checkObj("gift") === "pony");
- text: <code>checkObj("pet")</code> should return <code>"kitten"</code>.
testString: assert(checkObj("pet") === "kitten", '<code>checkObj("pet")</code> should return <code>"kitten"</code>.');
testString: assert(checkObj("pet") === "kitten");
- text: <code>checkObj("house")</code> should return <code>"Not Found"</code>.
testString: assert(checkObj("house") === "Not Found", '<code>checkObj("house")</code> should return <code>"Not Found"</code>.');
testString: assert(checkObj("house") === "Not Found");
```

View File

@ -35,9 +35,9 @@ Correct the assignment to <code>myStr</code> so it contains the string value of
```yml
tests:
- text: <code>myStr</code> should have a value of <code>Hello World</code>
testString: assert(myStr === "Hello World", '<code>myStr</code> should have a value of <code>Hello World</code>');
testString: assert(myStr === "Hello World");
- text: Do not change the code above the line
testString: assert(/myStr = "Jello World"/.test(code), 'Do not change the code above the line');
testString: assert(/myStr = "Jello World"/.test(code));
```

View File

@ -22,9 +22,9 @@ Modify the <code>welcomeToBooleans</code> function so that it returns <code>true
```yml
tests:
- text: The <code>welcomeToBooleans()</code> function should return a boolean &#40;true/false&#41; value.
testString: assert(typeof welcomeToBooleans() === 'boolean', 'The <code>welcomeToBooleans()</code> function should return a boolean &#40;true/false&#41; value.');
testString: assert(typeof welcomeToBooleans() === 'boolean');
- text: <code>welcomeToBooleans()</code> should return true.
testString: assert(welcomeToBooleans() === true, '<code>welcomeToBooleans()</code> should return true.');
testString: assert(welcomeToBooleans() === true);
```

View File

@ -32,17 +32,17 @@ Modify the existing declarations and assignments so their names use <dfn>camelCa
```yml
tests:
- text: <code>studlyCapVar</code> is defined and has a value of <code>10</code>
testString: assert(typeof studlyCapVar !== 'undefined' && studlyCapVar === 10, '<code>studlyCapVar</code> is defined and has a value of <code>10</code>');
testString: assert(typeof studlyCapVar !== 'undefined' && studlyCapVar === 10);
- text: <code>properCamelCase</code> is defined and has a value of <code>"A String"</code>
testString: assert(typeof properCamelCase !== 'undefined' && properCamelCase === "A String", '<code>properCamelCase</code> is defined and has a value of <code>"A String"</code>');
testString: assert(typeof properCamelCase !== 'undefined' && properCamelCase === "A String");
- text: <code>titleCaseOver</code> is defined and has a value of <code>9000</code>
testString: assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000, '<code>titleCaseOver</code> is defined and has a value of <code>9000</code>');
testString: assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000);
- text: <code>studlyCapVar</code> should use camelCase in both declaration and assignment sections.
testString: assert(code.match(/studlyCapVar/g).length === 2, '<code>studlyCapVar</code> should use camelCase in both declaration and assignment sections.');
testString: assert(code.match(/studlyCapVar/g).length === 2);
- text: <code>properCamelCase</code> should use camelCase in both declaration and assignment sections.
testString: assert(code.match(/properCamelCase/g).length === 2, '<code>properCamelCase</code> should use camelCase in both declaration and assignment sections.');
testString: assert(code.match(/properCamelCase/g).length === 2);
- text: <code>titleCaseOver</code> should use camelCase in both declaration and assignment sections.
testString: assert(code.match(/titleCaseOver/g).length === 2, '<code>titleCaseOver</code> should use camelCase in both declaration and assignment sections.');
testString: assert(code.match(/titleCaseOver/g).length === 2);
```

View File

@ -32,13 +32,13 @@ Create a function <code>addFive</code> without any arguments. This function adds
```yml
tests:
- text: <code>addFive</code> should be a function
testString: assert(typeof addFive === 'function', '<code>addFive</code> should be a function');
testString: assert(typeof addFive === 'function');
- text: <code>sum</code> should be equal to 8
testString: assert(sum === 8, '<code>sum</code> should be equal to 8');
testString: assert(sum === 8);
- text: Returned value from <code>addFive</code> should be <code>undefined</code>
testString: assert(addFive() === undefined, 'Returned value from <code>addFive</code> should be <code>undefined</code>');
testString: assert(addFive() === undefined);
- text: Inside of your functions, add 5 to the <code>sum</code> variable
testString: assert(code.match(/(sum\s*\=\s*sum\s*\+\s*5)|(sum\s*\+\=\s*5)/g).length === 1, 'Inside of your functions, add 5 to the <code>sum</code> variable');
testString: assert(code.match(/(sum\s*\=\s*sum\s*\+\s*5)|(sum\s*\+\=\s*5)/g).length === 1);
```

View File

@ -21,13 +21,13 @@ Initialize the three variables <code>a</code>, <code>b</code>, and <code>c</code
```yml
tests:
- text: <code>a</code> should be defined and evaluated to have the value of <code>6</code>
testString: assert(typeof a === 'number' && a === 6, '<code>a</code> should be defined and evaluated to have the value of <code>6</code>');
testString: assert(typeof a === 'number' && a === 6);
- text: <code>b</code> should be defined and evaluated to have the value of <code>15</code>
testString: assert(typeof b === 'number' && b === 15, '<code>b</code> should be defined and evaluated to have the value of <code>15</code>');
testString: assert(typeof b === 'number' && b === 15);
- text: <code>c</code> should not contain <code>undefined</code> and should have a value of "I am a String!"
testString: assert(!/undefined/.test(c) && c === "I am a String!", '<code>c</code> should not contain <code>undefined</code> and should have a value of "I am a String!"');
testString: assert(!/undefined/.test(c) && c === "I am a String!");
- text: Do not change code below the line
testString: assert(/a = a \+ 1;/.test(code) && /b = b \+ 5;/.test(code) && /c = c \+ " String!";/.test(code), 'Do not change code below the line');
testString: assert(/a = a \+ 1;/.test(code) && /b = b \+ 5;/.test(code) && /c = c \+ " String!";/.test(code));
```

View File

@ -36,9 +36,9 @@ Update the <code>myDog</code> object's name property. Let's change her name from
```yml
tests:
- text: Update <code>myDog</code>&apos;s <code>"name"</code> property to equal "Happy Coder".
testString: assert(/happy coder/gi.test(myDog.name), 'Update <code>myDog</code>&apos;s <code>"name"</code> property to equal "Happy Coder".');
testString: assert(/happy coder/gi.test(myDog.name));
- text: Do not edit the <code>myDog</code> definition
testString: 'assert(/"name": "Coder"/.test(code), ''Do not edit the <code>myDog</code> definition'');'
testString: 'assert(/"name": "Coder"/.test(code));'
```

View File

@ -24,9 +24,9 @@ Use <dfn>bracket notation</dfn> to find the first character in the <code>lastNam
```yml
tests:
- text: The <code>firstLetterOfLastName</code> variable should have the value of <code>L</code>.
testString: assert(firstLetterOfLastName === 'L', 'The <code>firstLetterOfLastName</code> variable should have the value of <code>L</code>.');
testString: assert(firstLetterOfLastName === 'L');
- text: You should use bracket notation.
testString: assert(code.match(/firstLetterOfLastName\s*?=\s*?lastName\[.*?\]/), 'You should use bracket notation.');
testString: assert(code.match(/firstLetterOfLastName\s*?=\s*?lastName\[.*?\]/));
```

View File

@ -23,9 +23,9 @@ Use <dfn>bracket notation</dfn> to find the last character in the <code>lastName
```yml
tests:
- text: <code>lastLetterOfLastName</code> should be "e".
testString: assert(lastLetterOfLastName === "e", '<code>lastLetterOfLastName</code> should be "e".');
testString: assert(lastLetterOfLastName === "e");
- text: You have to use <code>.length</code> to get the last letter.
testString: assert(code.match(/\.length/g).length === 2, 'You have to use <code>.length</code> to get the last letter.');
testString: assert(code.match(/\.length/g).length === 2);
```

View File

@ -23,9 +23,9 @@ Let's try to set <code>thirdLetterOfLastName</code> to equal the third letter of
```yml
tests:
- text: The <code>thirdLetterOfLastName</code> variable should have the value of <code>v</code>.
testString: assert(thirdLetterOfLastName === 'v', 'The <code>thirdLetterOfLastName</code> variable should have the value of <code>v</code>.');
testString: assert(thirdLetterOfLastName === 'v');
- text: You should use bracket notation.
testString: assert(code.match(/thirdLetterOfLastName\s*?=\s*?lastName\[.*?\]/), 'You should use bracket notation.');
testString: assert(code.match(/thirdLetterOfLastName\s*?=\s*?lastName\[.*?\]/));
```

View File

@ -23,9 +23,9 @@ Use <dfn>bracket notation</dfn> to find the second-to-last character in the <cod
```yml
tests:
- text: <code>secondToLastLetterOfLastName</code> should be "c".
testString: assert(secondToLastLetterOfLastName === 'c', '<code>secondToLastLetterOfLastName</code> should be "c".');
testString: assert(secondToLastLetterOfLastName === 'c');
- text: You have to use <code>.length</code> to get the second last letter.
testString: assert(code.match(/\.length/g).length === 2, 'You have to use <code>.length</code> to get the second last letter.');
testString: assert(code.match(/\.length/g).length === 2);
```

View File

@ -38,15 +38,15 @@ Create an <code>if</code> statement inside the function to return <code>"Yes, th
```yml
tests:
- text: <code>trueOrFalse</code> should be a function
testString: assert(typeof trueOrFalse === "function", '<code>trueOrFalse</code> should be a function');
testString: assert(typeof trueOrFalse === "function");
- text: <code>trueOrFalse(true)</code> should return a string
testString: assert(typeof trueOrFalse(true) === "string", '<code>trueOrFalse(true)</code> should return a string');
testString: assert(typeof trueOrFalse(true) === "string");
- text: <code>trueOrFalse(false)</code> should return a string
testString: assert(typeof trueOrFalse(false) === "string", '<code>trueOrFalse(false)</code> should return a string');
testString: assert(typeof trueOrFalse(false) === "string");
- text: <code>trueOrFalse(true)</code> should return "Yes, that was true"
testString: assert(trueOrFalse(true) === "Yes, that was true", '<code>trueOrFalse(true)</code> should return "Yes, that was true"');
testString: assert(trueOrFalse(true) === "Yes, that was true");
- text: <code>trueOrFalse(false)</code> should return "No, that was false"
testString: assert(trueOrFalse(false) === "No, that was false", '<code>trueOrFalse(false)</code> should return "No, that was false"');
testString: assert(trueOrFalse(false) === "No, that was false");
```

View File

@ -55,13 +55,13 @@ Use multiple <code>conditional operators</code> in the <code>checkSign</code> fu
```yml
tests:
- text: <code>checkSign</code> should use multiple <code>conditional operators</code>
testString: assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code), '<code>checkSign</code> should use multiple <code>conditional operators</code>');
testString: assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code));
- text: <code>checkSign(10)</code> should return "positive". Note that capitalization matters
testString: assert(checkSign(10) === 'positive', '<code>checkSign(10)</code> should return "positive". Note that capitalization matters');
testString: assert(checkSign(10) === 'positive');
- text: <code>checkSign(-12)</code> should return "negative". Note that capitalization matters
testString: assert(checkSign(-12) === 'negative', '<code>checkSign(-12)</code> should return "negative". Note that capitalization matters');
testString: assert(checkSign(-12) === 'negative');
- text: <code>checkSign(0)</code> should return "zero". Note that capitalization matters
testString: assert(checkSign(0) === 'zero', '<code>checkSign(0)</code> should return "zero". Note that capitalization matters');
testString: assert(checkSign(0) === 'zero');
```

View File

@ -44,13 +44,13 @@ Use the <code>conditional operator</code> in the <code>checkEqual</code> functio
```yml
tests:
- text: <code>checkEqual</code> should use the <code>conditional operator</code>
testString: assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code), '<code>checkEqual</code> should use the <code>conditional operator</code>');
testString: assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code));
- text: <code>checkEqual(1, 2)</code> should return "Not Equal"
testString: assert(checkEqual(1, 2) === "Not Equal", '<code>checkEqual(1, 2)</code> should return "Not Equal"');
testString: assert(checkEqual(1, 2) === "Not Equal");
- text: <code>checkEqual(1, 1)</code> should return "Equal"
testString: assert(checkEqual(1, 1) === "Equal", '<code>checkEqual(1, 1)</code> should return "Equal"');
testString: assert(checkEqual(1, 1) === "Equal");
- text: <code>checkEqual(1, -1)</code> should return "Not Equal"
testString: assert(checkEqual(1, -1) === "Not Equal", '<code>checkEqual(1, -1)</code> should return "Not Equal"');
testString: assert(checkEqual(1, -1) === "Not Equal");
```
</section>

View File

@ -26,15 +26,15 @@ Use <code>parseInt()</code> in the <code>convertToInteger</code> function so it
```yml
tests:
- text: <code>convertToInteger</code> should use the <code>parseInt()</code> function
testString: assert(/parseInt/g.test(code), '<code>convertToInteger</code> should use the <code>parseInt()</code> function');
testString: assert(/parseInt/g.test(code));
- text: <code>convertToInteger("10011")</code> should return a number
testString: assert(typeof(convertToInteger("10011")) === "number", '<code>convertToInteger("10011")</code> should return a number');
testString: assert(typeof(convertToInteger("10011")) === "number");
- text: <code>convertToInteger("10011")</code> should return 19
testString: assert(convertToInteger("10011") === 19, '<code>convertToInteger("10011")</code> should return 19');
testString: assert(convertToInteger("10011") === 19);
- text: <code>convertToInteger("111001")</code> should return 57
testString: assert(convertToInteger("111001") === 57, '<code>convertToInteger("111001")</code> should return 57');
testString: assert(convertToInteger("111001") === 57);
- text: <code>convertToInteger("JamesBond")</code> should return NaN
testString: assert.isNaN(convertToInteger("JamesBond"), '<code>convertToInteger("JamesBond")</code> should return NaN');
testString: assert.isNaN(convertToInteger("JamesBond"));
```

View File

@ -23,15 +23,15 @@ Use <code>parseInt()</code> in the <code>convertToInteger</code> function so it
```yml
tests:
- text: <code>convertToInteger</code> should use the <code>parseInt()</code> function
testString: assert(/parseInt/g.test(code), '<code>convertToInteger</code> should use the <code>parseInt()</code> function');
testString: assert(/parseInt/g.test(code));
- text: <code>convertToInteger("56")</code> should return a number
testString: assert(typeof(convertToInteger("56")) === "number", '<code>convertToInteger("56")</code> should return a number');
testString: assert(typeof(convertToInteger("56")) === "number");
- text: <code>convertToInteger("56")</code> should return 56
testString: assert(convertToInteger("56") === 56, '<code>convertToInteger("56")</code> should return 56');
testString: assert(convertToInteger("56") === 56);
- text: <code>convertToInteger("77")</code> should return 77
testString: assert(convertToInteger("77") === 77, '<code>convertToInteger("77")</code> should return 77');
testString: assert(convertToInteger("77") === 77);
- text: <code>convertToInteger("JamesBond")</code> should return NaN
testString: assert.isNaN(convertToInteger("JamesBond"), '<code>convertToInteger("JamesBond")</code> should return NaN');
testString: assert.isNaN(convertToInteger("JamesBond"));
```

Some files were not shown because too many files have changed in this diff Show More