diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json
index a0f9635795..586650ddec 100644
--- a/challenges/basic-javascript.json
+++ b/challenges/basic-javascript.json
@@ -65,7 +65,7 @@
"assert((function(){if(typeof(myName) !== \"undefined\" && typeof(myName) === \"string\" && myName.length > 0){return true;}else{return false;}})(), 'message: myName
should be a string that contains at least one character in it.');"
],
"challengeSeed": [
- "// var ourName = \"Free Code Camp\";",
+ "var ourName = \"Free Code Camp\";",
"",
"",
"// Only change code above this line.",
@@ -87,9 +87,9 @@
"assert((function(){if(typeof(myLastName) !== \"undefined\" && typeof(myLastName) === \"string\" && myLastName.length > 0){return true;}else{return false;}})(), 'message: myLastName
should be a string with at least one character in it.');"
],
"challengeSeed": [
- "// var name = \"Alan Turing\";",
- "// var firstName = \"Alan\";",
- "// var lastName = \"Turing\";",
+ "var name = \"Alan Turing\";",
+ "var firstName = \"Alan\";",
+ "var lastName = \"Turing\";",
"",
"",
"// Only change code above this line.",
@@ -230,7 +230,7 @@
"title": "Use Bracket Notation to Find the Nth-to-Last Character in a String",
"description": [
"In order to get the last letter of a string, you can subtract one from the string's length.",
- "For example, you can get the value of the third-to-last letter of the var firstName = \"Charles\"
string by using firstName[firstName.length - 3]
.",
+ "For example, you can get the value of the third-to-last letter of the var firstName = \"Charles\"
string by using firstName[firstName.length - 3]
",
"Use bracket notation
to find the second-to-last character in the lastName
string.",
"Try looking at the thirdToLastLetterOfFirstName
variable declaration if you get stuck."
],
@@ -288,7 +288,7 @@
"assert((function(){if(difference === 12 && editor.getValue().match(/\\-/g)){return true;}else{return false;}})(), 'message: Make the variable difference
equal 12.');"
],
"challengeSeed": [
- "var difference = 45 - 0; //12",
+ "var difference = 45 - 0;",
"",
"// Only change code above this line.",
"",
@@ -390,10 +390,10 @@
"Change the 0.0
so that your quotient will equal 2.2
."
],
"tests": [
- "assert((function(){if(quotient === 2.2 && editor.getValue().match(/\\//g)){return true;}else{return false;}})(), 'message: Make the variable quotient
equal 2.2.');"
+ "assert((function(){if(quotient === 2.2 && editor.getValue().match(/\\//g)){return true;}else{return false;}})(), 'message: Make the variable quotient
equal 2.2
.');"
],
"challengeSeed": [
- "var quotient = 0.0 / 2.0; // equals 2.2",
+ "var quotient = 0.0 / 2.0;",
"",
"",
"// Only change code above this line.",
@@ -418,7 +418,7 @@
"assert(typeof(myArray[1]) !== 'undefined' && typeof(myArray[1]) == 'number', 'message: The second item in myArray
should be a number
.');"
],
"challengeSeed": [
- "// var array = [\"John\", 23];",
+ "var array = [\"John\", 23];",
"",
"// Only change code below this line.",
"",
@@ -471,8 +471,9 @@
"assert((function(){if(typeof(myArray) != 'undefined' && typeof(myData) != 'undefined' && myArray[0] == myData){return true;}else{return false;}})(), 'message: The variable myData
should equal the first value of myArray
.');"
],
"challengeSeed": [
- "// var ourArray = [1,2,3];",
- "// var ourData = ourArray[0]; // equals 1",
+ "var ourArray = [1,2,3];",
+ "",
+ "var ourData = ourArray[0]; // equals 1",
"",
"var myArray = [1,2,3];",
"",
@@ -502,6 +503,7 @@
],
"challengeSeed": [
"var ourArray = [1,2,3];",
+ "",
"ourArray[1] = 3; // ourArray now equals [1,3,3].",
"",
"var myArray = [1,2,3];",
@@ -509,6 +511,7 @@
"// Only change code below this line.",
"",
"",
+ "",
"// Only change code above this line.",
"",
"if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}"
@@ -527,18 +530,18 @@
],
"tests": [
"assert((function(d){if(d[0] == 'John' && d[1] == 23 && d[2] == undefined){return true;}else{return false;}})(myArray), 'message: myArray
should only contain [\"John\", 23]
.');",
- "assert((function(d){if(d[0] == 'cat' && d[1] == 2 && d[2] == undefined){return true;}else{return false;}})(removed), 'message: removedFromMyArray
should only contain [\"cat\", 2]
.');"
-
+ "assert((function(d){if(d[0] == 'cat' && d[1] == 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray), 'message: removedFromMyArray
should only contain [\"cat\", 2]
.');"
],
"challengeSeed": [
"var ourArray = [1,2,3];",
- "var removedFromOurArray = numbers.pop(); // removedFromOurArray now equals 3, and ourArray now equals [1,2]",
+ "",
+ "var removedFromOurArray = ourArray.pop(); // removedFromOurArray now equals 3, and ourArray now equals [1,2]",
"",
"var myArray = [\"John\", 23, [\"cat\", 2]];",
"",
"// Only change code below this line.",
"",
- "",
+ "var removedFromMyArray;",
"",
"// Only change code above this line.",
"",
@@ -600,7 +603,7 @@
"",
"// Only change code below this line.",
"",
- "",
+ "var removedFromMyArray;",
"",
"// Only change code above this line.",
"",
@@ -725,7 +728,7 @@
"};",
"",
"// Only change code above this line.",
- "// We use this function to show you the value of your variable in your output box.",
+ "",
"(function(z){return z;})(myDog);"
],
"type": "waypoint",
@@ -749,7 +752,7 @@
"Let's update yourDog
object's name property. Let's change her name from \"Coder\" to \"Happy Coder\"."
],
"tests": [
- "assert(myDog.name.match(/Happy Coder/), 'message: Update myDog
's \"name\"
property to equal \"Happy Coder\".');"
+ "assert(/happy coder/gi.test(myDog.name), 'message: Update myDog
's \"name\"
property to equal \"Happy Coder\".');"
],
"challengeSeed": [
"var ourDog = {",
@@ -776,7 +779,7 @@
"",
"",
"// Only change code above this line.",
- "// We use this function to show you the value of your variable in your output box.",
+ "",
"(function(z){return z;})(myDog);"
],
"type": "waypoint",
@@ -818,7 +821,6 @@
"",
"// Only change code above this line.",
"",
- "// We use this function to show you the value of your variable in your output box.",
"(function(z){return z;})(myDog);"
],
"type": "waypoint",
@@ -840,7 +842,7 @@
" \"name\": \"Camper\",",
" \"legs\": 4,",
" \"tails\": 1,",
- " \"friends\": [\"everything!\"]",
+ " \"friends\": [\"everything!\"],",
" \"bark\": \"bow-wow\"",
"};",
"",
@@ -850,7 +852,7 @@
" \"name\": \"Happy Coder\",",
" \"legs\": 4,",
" \"tails\": 1,",
- " \"friends\": [\"Free Code Camp Campers\"]",
+ " \"friends\": [\"Free Code Camp Campers\"],",
" \"bark\": \"woof\"",
"};",
"",
@@ -860,7 +862,6 @@
"",
"// Only change code above this line.",
"",
- "// We use this function to show you the value of your variable in your output box.",
"(function(z){return z;})(myDog);"
],
"type": "waypoint",
@@ -887,18 +888,21 @@
],
"tests": [
"assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for
loop for this.');",
- "assert.deepEqual(myArray, [0,1,2,3,4], 'message: myArray
should equal [0,1,2,3,4].');"
+ "assert.deepEqual(myArray, [0,1,2,3,4], 'message: myArray
should equal [0,1,2,3,4]
');"
],
"challengeSeed": [
"var ourArray = [];",
+ "",
"for(var i = 0; i < 5; i++){",
" ourArray.push(i);",
"}",
+ "",
"var myArray = [];",
"",
"// Only change code below this line.",
"",
-
+ "",
+ "",
"// Only change code above this line.",
"",
"if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}",
@@ -918,26 +922,28 @@
" ourArray.push(i);
",
"}
",
"ourArray
will now contain [0,2,4,6,8] ",
- "Let's change our initialization
and final-expression
so we can count by odd numbers."
+ "Let's change our initialization
and final-expression
so we can count by odd numbers.",
+ "Push the odd numbers from 1 through 9 to myArray
using a for loop
."
],
"tests":[
"assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for
loop for this.');",
- "assert.deepEqual(myArray, [1,3,5,7,9], 'message: myArray
should equal [1,3,5,7,9].');"
+ "assert.deepEqual(myArray, [1,3,5,7,9], 'message: myArray
should equal [1,3,5,7,9]
');"
],
"challengeSeed":[
"var ourArray = [];",
+ "",
"for(var i = 1; i < 10; i += 2){",
" ourArray.push(i);",
"}",
+ "",
"var myArray = [];",
"",
"// Only change code below this line.",
"",
- "// Push the odd numbers from one through nine to myArray using a \"for loop\" like above.",
+ "",
"",
"// Only change code above this line.",
- "// We use this function to show you the value of your variable in your output box.",
- "// You'll learn about functions soon.",
+ "",
"if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}",
""
],
@@ -955,27 +961,29 @@
"for(var i = 10; i > 0; i -= 2) {
",
" ourArray.push(i);
",
"}
",
- "ourArray
will now contain [10,8,6,4,2] ",
- "Let's change our initialization
and final-expression
so we can count backward by twos for numbers."
+ "ourArray
will now contain [10,8,6,4,2]
",
+ "Let's change our initialization
and final-expression
so we can count backward by twos for numbers.",
+ "Push the odd numbers from 9 through 1 to myArray
using a for loop
."
],
"tests":[
"assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for
loop for this.');",
- "assert.deepEqual(myArray, [9,7,5,3,1], 'message: myArray
should equal [9,7,5,3,1].');"
+ "assert.deepEqual(myArray, [9,7,5,3,1], 'message: myArray
should equal [9,7,5,3,1]
');"
],
"challengeSeed":[
"ourArray = [];",
+ "",
"for(var i = 9; i > 0; i -= 2){",
" ourArray.push(i);",
"}",
+ "",
"var myArray = [];",
"",
"// Only change code below this line.",
"",
- "// Push the odd numbers from nine through one to myArray using a \"for loop\" like above.",
+ "",
"",
"// Only change code above this line.",
- "// We use this function to show you the value of your variable in your output box.",
- "// You'll learn about functions soon.",
+ "",
"if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}",
""
],
@@ -994,17 +1002,19 @@
" ourArray.push(i);
",
" i++;
",
"}
",
- "Let's try getting a while loop to work by pushing values to an array."
+ "Let's try getting a while loop to work by pushing values to an array.",
+ "Push the numbers 0 through 4 to myArray
using a while loop
."
],
"tests": [
"assert(editor.getValue().match(/while/g), 'message: You should be using a while
loop for this.');",
- "assert.deepEqual(myArray, [0,1,2,3,4], 'message: myArray
should equal [0,1,2,3,4].');"
+ "assert.deepEqual(myArray, [0,1,2,3,4], 'message: myArray
should equal [0,1,2,3,4]
');"
],
"challengeSeed": [
"var myArray = [];",
+ "",
"// Only change code below this line.",
"",
- "// Push the numbers zero through four to myArray using a \"while loop\".",
+ "",
"",
"// Only change code above this line.",
"",
@@ -1020,16 +1030,17 @@
"description": [
"Random numbers are useful for creating random behavior.",
"JavaScript has a Math.random()
function that generates a random decimal number.",
- "Change myFunction to return a random number instead of returning 0
.",
+ "Change myFunction
to return a random number instead of returning 0
.",
"Note that you can return a function, just like you would return a variable or value."
],
"tests": [
"assert(typeof(myFunction()) === \"number\", 'message: myFunction
should return a random number.');",
"assert((myFunction()+''). match(/\\./g), 'message: The number returned by myFunction
should be a decimal.');",
- "assert(editor.getValue().match(/Math\\.random/g).length >= 2, 'message: You should be using Math.random
to generate the random decimal number.');"
+ "assert(editor.getValue().match(/Math\\.random/g).length >= 0, 'message: You should be using Math.random
to generate the random decimal number.');"
],
"challengeSeed": [
"function myFunction() {",
+ "",
" // Only change code below this line.",
"",
" return 0;",
@@ -1086,7 +1097,7 @@
"description": [
"Instead of generating a random number between zero and a given number like we did before, we can generate a random number that falls within a range of two specific numbers.",
"To do this, we'll define a minimum number min
and a maximum number max
.",
- "Here's the formula we'll use. Take a moment to read and try to understand what this code is doing.",
+ "Here's the formula we'll use. Take a moment to read it and try to understand what this code is doing:",
"Math.floor(Math.random() * (max - min + 1)) + min
",
"Define two variables: myMin
and myMax, and set them both equal to numbers.",
"Then create a function called myFunction
that returns a random number that's greater than or equal to myMin
, and is less than myMax
."
@@ -1095,7 +1106,7 @@
"assert(myFunction() >= myMin, 'message: The random number generated by myFunction
should be greater than or equal to your minimum number, myMin
.');",
"assert(myFunction() <= myMax, 'message: The random number generated by myFunction
should be less than or equal to your maximum number, myMax
.');",
"assert(myFunction() % 1 === 0 , 'message: The random number generated by myFunction
should be an integer, not a decimal.');",
- "assert((function(){if(editor.getValue().match(/myMax/g).length >= 3 && editor.getValue().match(/myMin/g).length >= 4 && editor.getValue().match(/Math.floor/g) && editor.getValue().match(/Math.random/g)){return true;}else{return false;}})(), 'message: You should be using a function called myFunction()
to calculate your random number in your range.');"
+ "assert((function(){if(editor.getValue().match(/myMax/g).length > 1 && editor.getValue().match(/myMin/g).length > 2 && editor.getValue().match(/Math.floor/g) && editor.getValue().match(/Math.random/g)){return true;}else{return false;}})(), 'message: myFunction()
should use use both myMax
and myMin
, and return a random number in your range.');"
],
"challengeSeed": [
"var ourMin = 1;",
@@ -1108,15 +1119,17 @@
"",
"}",
"",
- " // Only change code below this line.",
- "",
- "",
- "",
+ "// Only change code below this line.",
"",
+ "var myMin;",
"",
+ "var myMax;",
"",
+ "function myFunction() {",
"",
+ " return;",
"",
+ "}",
"",
"// Only change code above this line.",
"",
@@ -1142,14 +1155,15 @@
"Create if
and else
statements to return the string \"heads\"
if the flip variable is zero, or else return the string \"tails\"
if the flip variable is not zero."
],
"tests": [
+ "assert(editor.getValue().match(/if/g).length >= 2, 'message: Create a new if statement.');",
+ "assert(editor.getValue().match(/else/g).length >= 1, 'message: Created a new else statement.');",
"assert((function(){var result = myFunction();if(result === 'heads' || result === 'tails'){return true;} else {return false;}})(), 'message: myFunction
should either return heads
or tails
.');",
- "assert((function(){var result = myFunction();if(result === 'heads' && flip === 0 || result === 'tails' && flip !== 0){return true;} else {return false;}})(), 'message: myFunction
should return heads
when flip equals 0 and tails
when flip equals 1.');",
- "assert(editor.getValue().match(/if/g).length >= 4, 'message: You should have created a new if statement.');",
- "assert(editor.getValue().match(/else/g).length >= 2, 'message: You should have created a new else statement.');"
+ "assert((function(){var result = myFunction();if(result === 'heads' && flip === 0 || result === 'tails' && flip !== 0){return true;} else {return false;}})(), 'message: myFunction
should return heads
when flip equals 0 and tails
when flip equals 1.');"
],
"challengeSeed": [
"var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;",
- "function myFunction(){",
+ "",
+ "function myFunction() {",
"",
" // Only change code below this line.",
"",
diff --git a/challenges/bootstrap.json b/challenges/bootstrap.json
index 239ecf1903..4306f0b5f7 100644
--- a/challenges/bootstrap.json
+++ b/challenges/bootstrap.json
@@ -179,7 +179,8 @@
"title": "Center Text with Bootstrap",
"description": [
"Now that we're using Bootstrap, we can center our heading element to make it look better. All we need to do is add the class text-center
to our h2
element.",
- "Remember that you can add several classes to the same element by separating each of them with a space, like this: <h2 class=\"red-text text-center\">your text</h2>
."
+ "Remember that you can add several classes to the same element by separating each of them with a space, like this:",
+ "<h2 class=\"red-text text-center\">your text</h2>
"
],
"tests": [
"assert($(\"h2\").hasClass(\"text-center\"), 'Your h2
element should be centered by applying the class text-center
')"
@@ -892,7 +893,8 @@
"
",
"By using the span
element, you can put several elements together, and even style different parts of the same element differently.",
"Nest the word \"love\" in your \"Things cats love\" element below within a span
element. Then give that span
the class text-danger
to make the text red.",
- "Here's how you would do this with the \"Top 3 things cats hate\" element: <p>Top 3 things cats <span class = \"text-danger\">hate</span></p>
"
+ "Here's how you would do this with the \"Top 3 things cats hate\" element:",
+ "<p>Top 3 things cats <span class = \"text-danger\">hate</span></p>
"
],
"tests": [
"assert($(\"p span\") && $(\"p span\").length > 0, 'Your span
element should be inside your p
element.')",
@@ -2111,11 +2113,11 @@
"When we start using jQuery, we will modify HTML elements without needing to actually change them in HTML.",
"Let's make sure that everyone knows they shouldn't actually modify any of this code directly.",
"Remember that you can start a comment with <!--
and end a comment with -->
",
- "Add a comment at the top of your HTML that says You shouldn't need to modify code below this line
."
+ "Add a comment at the top of your HTML that says Only change code above this line.
"
],
"tests": [
"assert(editor.match(/.*\\n+.+/g), 'Be sure to close your comment with -->
.')"
],
"challengeSeed": [
diff --git a/challenges/html5-and-css.json b/challenges/html5-and-css.json
index 58adc46b54..4372a5cf6b 100644
--- a/challenges/html5-and-css.json
+++ b/challenges/html5-and-css.json
@@ -512,9 +512,9 @@
],
"tests": [
"assert($(\"h2\").css(\"color\") === \"rgb(255, 0, 0)\", 'Your h2
element should be red.')",
- "assert($(\"h2\").hasClass(\"red-text\"), 'Your h2
element should have the class red-text
')",
+ "assert($(\"h2\").hasClass(\"red-text\"), 'Your h2
element should have the class red-text
.')",
"assert($(\"p\").css(\"color\") === \"rgb(255, 0, 0)\", 'Your p
element should be red.')",
- "assert($(\"p\").hasClass(\"red-text\"), 'Your p
element should have the class red-text
')"
+ "assert($(\"p\").hasClass(\"red-text\"), 'Your p
element should have the class red-text
.')"
],
"challengeSeed": [
"