diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json
index dc6b2427f1..75edd1c77a 100644
--- a/challenges/basic-javascript.json
+++ b/challenges/basic-javascript.json
@@ -7,19 +7,19 @@
"title": "Comment your JavaScript Code",
"difficulty":"9.98",
"description":[
- "A comment is a very useful line of code that is not actually ran by the machine executing it. With this property comments are the perfect way of creating notes to yourself or anyone else who reads your code describing what the code does",
- "It's an extremely important part in writing good, efficient and maintainable code and a requirement by most employers",
- "Let's take a look at the two ways in which we can write a comment in JavaScript",
- "//This is a comment
",
- "These comment out the entire line that they are on",
+ "Comment are lines of code that the computer intentionally ignores. Comments are a great way leave notes to yourself and other people who will later need to maintain your code and figure out what it does.",
+ "Employers will expect you to be able to writing readable code, and comments are a great way to improve readability.",
+ "Let's take a look at the two ways in which we can write a comment in JavaScript.",
+ "The double-slash comment will comment out all the text on the line that follows:",
+ "//This is a comment.
",
+ "The slash-star-star-slash comment will comment out everything the /*
and */
characters:",
"/*This is also a comment*/
",
- "These comment out everything in between /*
and */
",
- "Try creating one of each now."
+ "Try creating one of each."
],
"tests":[
- "assert(editor.getValue().match(/(\\/\\*)...../g), 'Make sure you have at least one \/\\* \\*\/ style comment that has at least five letters in it');",
- "assert(editor.getValue().match(/(\\*\\/)/g), 'Make sure that you close the coment with a \\*\/');",
- "assert(editor.getValue().match(/(\\/\\/)...../g), 'Make sure that there is at least one \\/\\/ style comment with at least five letters in it');"
+ "assert(editor.getValue().match(/(\\/\\*)...../g), 'Create a \/\\* \\*\/
style comment that contains at least five letters.');",
+ "assert(editor.getValue().match(/(\\*\\/)/g), 'Make sure that you close the comment with a \\*\/
');",
+ "assert(editor.getValue().match(/(\\/\\/)...../g), 'Create a \\/\\/
style comment that contains at least five letters');"
],
"challengeSeed":[
],
@@ -31,20 +31,22 @@
"title": "Understand Boolean Values",
"difficulty": "9.98001",
"description": [
- "Return true",
- "A boolean is a type of variable that represents either true or false (Named after the British mathematician George Boole).",
- "Booleans are often the result of a function or a comparative operation, for example 1==1
is true whereas 1==2
is false.",
- "They are most commonly found inside if
statements which we shall cover later",
- "For now let's modify our welcomeToBooleans
function so that it will return true
instead of false
when the run button is clicked"
+ "In computer science, \"data structures\" are variables that hold data. JavaScript has seven of these. For example, the Number
data structure holds numbers.",
+ "Let's learn about the most basic data structure of all: the Boolean
. Booleans can only hold the value of either true or false. They are basically little on-off switches.",
+ "Let's modify our welcomeToBooleans
function so that it will return true
instead of false
when the run button is clicked."
],
"tests": [
- "assert(typeof(welcomeToBooleans())==\"boolean\", 'The value returned by welcomeToBooleans() should be a boolean value. (true of false)');",
- "assert(welcomeToBooleans() == true, 'The value returned by welcomeToBooleans() should be true');"
+ "assert(typeof(welcomeToBooleans())==\"boolean\", 'The welcomeToBooleans()
function should return a boolean (true/false) value.')",
+ "assert(welcomeToBooleans() == true, 'welcomeToBooleans()
should return true.')"
],
"challengeSeed": [
"function welcomeToBooleans() {",
- "// Good luck!",
+ "",
+ "// don't change code above here",
+ "",
"return false;",
+ "",
+ "// don't change code below here",
"}",
"",
"welcomeToBooleans();"
@@ -57,11 +59,10 @@
"title": "Declare JavaScript Variables",
"difficulty": "9.9801",
"description": [
- "Now, use the var
keyword to create a variable
called myName
. Set its value to your name.",
- "Variables
are used to store values.",
- "The name variable comes from the fact that its value varies!",
- "Now let's create our first variable called myName and because it's a name let's make it a string!",
- "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in camel case
. An example of camel case is: camelCase.",
+ "When we store data in a data structure
, we call it a variables
. These variables are no different from the x and y variables you use in basic math.",
+ "Let's create our first variable and call it \"myName\".",
+ "You'll notice that in myName
, we didn't use a space, and that the \"N\" is capitalized. JavaScript variables are written in camel case
. An example of camel case is: camelCase.",
+ "Now, use the var
keyword to create a variable called myName
. Set its value to your name, in double quotes.",
"Look at the ourName
example if you get stuck."
],
"tests": [
@@ -70,9 +71,10 @@
"challengeSeed": [
"// var ourName = \"Free Code Camp\";",
"",
- "// You can ignore this.",
- "// We use this to show you the value of your variable in your output box.",
- "// We'll learn about functions soon.",
+ "",
+ "// You can ignore everything below 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(myName) !== \"undefined\"){(function(v){return(v);})(myName);}"
],
@@ -84,9 +86,9 @@
"title": "Declare String Variables",
"difficulty": "9.9802",
"description": [
- "Programs will almost always have several different variables that are used to keep track of several different pieces of data",
- "We are now going to go and create two new variables myFirstName
and myLastName
that are strings",
- "You can assign these variables to be equal to your first and last names respectively."
+ "In the past challenge, we used the code var myName = \"your name\"
. This is what we call a String
data structure (variable). It is just a \"string\" of characters. JavaScript strings are always wrapped in quotes.",
+ "Now let's create two new string variables: myFirstName
and myLastName
.",
+ "Assign these variables to equal to your first and last names respectively."
],
"tests": [
"assert((function(){if(typeof(myFirstName) !== \"undefined\" && typeof(myFirstName) == \"string\" && myFirstName.length > 0){return(true);}else{return(false);}})(), 'myFirstName should be a string with a least one character in it');",
@@ -98,9 +100,9 @@
"// var ourLastName = \"Code Camp\";",
"",
"",
- "// You can ignore this.",
- "// We use this to show you the value of your variable in your output box.",
- "// We'll learn about functions soon.",
+ "// You can ignore everything below 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(myFirstName) !== \"undefined\" && typeof(myLastName) !== \"undefined\"){(function(y,z){return(y + ', ' + z);})(myFirstName, myLastName);}"
],
"type": "waypoint",
@@ -131,9 +133,9 @@
"",
"",
"",
- "// You can ignore this.",
- "// We use this to show you the value of your variable in your output box.",
- "// We'll learn about functions soon.",
+ "// You can ignore everything below 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(lastNameLength) != \"undefined\"){(function(v){return(v);})(lastNameLength);}"
],
"type": "waypoint",
@@ -166,9 +168,9 @@
"firstLetterOfLastName = lastName;",
"",
"",
- "// You can ignore this.",
- "// We use this to show you the value of your variable in your output box.",
- "// We'll learn about functions soon.",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
"(function(v){return(v);})(firstLetterOfLastName);"
],
"type": "waypoint",
@@ -197,9 +199,9 @@
"var thirdLetterOfLastName = lastName;",
"",
"",
- "// You can ignore this.",
- "// We use this to show you the value of your variable in your output box.",
- "// We'll learn about functions soon.",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
"(function(v){return(v);})(thirdLetterOfLastName);"
],
"type": "waypoint",
@@ -230,6 +232,9 @@
"var lastLetterOfLastName = lastName;",
"",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
"(function(v){return(v);})(lastLetterOfLastName);"
],
"type": "waypoint",
@@ -260,6 +265,9 @@
"var secondToLastLetterOfLastName = lastName;",
"",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
"(function(v){return(v);})(secondToLastLetterOfLastName);"
],
"type": "waypoint",
@@ -283,6 +291,9 @@
"",
"",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
"(function(z){return('add='+z);})(add);"
],
"type": "waypoint",
@@ -306,6 +317,9 @@
"",
"",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
"(function(z){return('subtract='+z);})(subtract);"
],
"type": "waypoint",
@@ -329,6 +343,9 @@
"",
"",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
"(function(z){return('multiply='+z);})(multiply);"
],
"type": "waypoint",
@@ -352,6 +369,9 @@
"",
"",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
"(function(z){return('divide='+z);})(divide);"
],
"type": "waypoint",
@@ -375,6 +395,9 @@
"",
"",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
"(function(){if(typeof(myDecimal) != \"undefined\"){return(myDecimal);}})();"
],
"type": "waypoint",
@@ -397,6 +420,9 @@
"",
"",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
"(function(y,z){return('multiply='+y+', divide='+z);})(multiply,divide);"
],
"type": "waypoint",
@@ -410,8 +436,7 @@
"In JavaScript we can store lists or collections of data in what are called arrays",
"Arrays are distinguished by the [
and ]
around the data. Each piece of data is separated by a ,
",
"Now let's create a new array called myArray
with a string
and a number
with a ,
separating each one",
- "Refer to the example if you get stuck",
- ""
+ "Refer to the example if you get stuck."
],
"tests": [
"assert(typeof(myArray) == \"object\", 'myArray should be an array');",
@@ -424,6 +449,9 @@
"var myArray = [];",
"",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
"(function(z){return(z);})(myArray);"
],
"type": "waypoint",
@@ -444,6 +472,9 @@
"var myArray = [];",
"",
"",
+ "// You can ignore everything below 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);})();}"
],
"type": "waypoint",
@@ -474,6 +505,9 @@
"",
"",
"",
+ "// You can ignore everything below 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\" && typeof(data) != \"undefined\"){(function(y,z){return('myArray = ' + JSON.stringify(y) + ', data = ' + JSON.stringify(z));})(myArray, data);}"
],
"type": "waypoint",
@@ -490,8 +524,7 @@
"var ourArray = [1,2,3];",
"ourArray[0] = 3;//ourArray equals [3,2,3]",
"",
- "Now Let's modify myArray
using an index",
- ""
+ "Now Let's modify myArray
using an index."
],
"tests":[
"assert((function(){if(typeof(myArray) != \"undefined\" && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return(true);}else{return(false);}})(), 'myArray should now be [3,2,3]');",
@@ -506,6 +539,9 @@
"",
"",
"",
+ "// You can ignore everything below 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);})();}"
],
"type": "waypoint",
@@ -537,6 +573,9 @@
"var removed = myArray;//This should be [\"cat\", 2] and myArray should now be [\"John\", 23]",
"",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
"(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z));})(myArray, removed);"
],
"type": "waypoint",
@@ -559,6 +598,9 @@
"//Add a [\"dog\", 3] to the end of myArray using push",
"",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
"(function(z){return('myArray = ' + JSON.stringify(z));})(myArray);"
],
"type": "waypoint",
@@ -582,6 +624,9 @@
"var removed = myArray;//This should be [\"John\"] and myArray should now be [23, [\"dog\", 3]]",
"",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
"(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z));})(myArray, removed);"
],
"type": "waypoint",
@@ -604,6 +649,9 @@
"//Add \"Paul\" to the start of myArray",
"",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
"(function(y, z){return('myArray = ' + JSON.stringify(y));})(myArray);"
],
"type": "waypoint",
@@ -637,7 +685,9 @@
"",
"",
"",
- "//Don't modify this!",
+ "// You can ignore everything below 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(myFunction) != \"undefined\"){",
"var f=myFunction(a,b);",
"(function(){return(f);})();",
@@ -686,6 +736,8 @@
" ",
"};",
"",
+ "// You can ignore everything below 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",
@@ -731,6 +783,8 @@
"//Now delete the property tails",
"",
"",
+ "// You can ignore everything below 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",
@@ -846,6 +900,8 @@
" return(0);",
"}",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
"(function(){return(myFunction());})();"
],
"type": "waypoint",
@@ -875,6 +931,8 @@
" return(Math.random());",
"}",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
"(function(){return(myFunction());})();"
],
"type": "waypoint",
@@ -903,6 +961,8 @@
" return(Math.random());",
"}",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
"(function(){return(myFunction());})();"
],
"type": "waypoint",
@@ -937,6 +997,8 @@
" ",
"}",
"",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
"(function(){return(myFunction());})();"
],
"type": "waypoint",
@@ -966,12 +1028,12 @@
"var test = (function(){",
" var testString = \"John and Alan went to the shop and got some milk\";",
"",
- "//Do Not Modify Above",
+ "//Do not modify above this line.",
"",
" var expression = /.+/gi;",
"",
- "//Do Not Modify Below",
- "",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
" return(testString.match(expression).length);",
"})();(function(){return(test);})();"
],
@@ -1000,8 +1062,8 @@
"",
" var expression = /.+/gi;",
"",
- "//Do Not Modify Below",
- "",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
" return(testString.match(expression).length);",
"})();(function(){return(test);})();"
],
@@ -1029,8 +1091,8 @@
"",
" var expression = /.+/gi;",
"",
- "//Do Not Modify Below",
- "",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
" return(testString.match(expression).length);",
"})();(function(){return(test);})();"
],
@@ -1057,8 +1119,8 @@
"",
" var expression = /.+/gi;",
"",
- "//Do Not Modify Below",
- "",
+ "// You can ignore everything below this line.",
+ "// We use this function to show you the value of your variable in your output box.",
" return(testString.match(expression).length);",
"})();(function(){return(test);})();"
],
@@ -1091,11 +1153,11 @@
" ",
" var images = [\"https://bit.ly/fcc-relaxing-cat\",\"https://bit.ly/fcc-relaxing-cat\",\"https://bit.ly/fcc-relaxing-cat\",\"https://bit.ly/fcc-relaxing-cat\",\"https://bit.ly/fcc-relaxing-cat\"];",
" ",
- " /*Don't modify above here*/",
+ " /*Don't modify above this line*/",
" ",
" ",
" ",
- " /*Don't modify below here*/",
+ " /*Don't modify below this line*/",
" ",
" $(\".logger\").html(\"\");",
" $(\".logger\").html(\"Not A Win\")",
@@ -1251,11 +1313,11 @@
" $(\".logger\").html(\"\");",
" $(\".logger\").html(\"Not A Win\")",
" ",
- " /*Don\"t modify above here*/",
+ " /*Don't modify above this line*/",
" ",
" ",
" ",
- " /*Don\"t modify below here*/",
+ " /*Don't modify below this line*/",
" ",
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
" $(\".logger\").html(slotOne);",
@@ -1411,11 +1473,11 @@
" $(\".logger\").html(\"\");",
" $(\".logger\").html(\"Not A Win\")",
" ",
- " /*Don't modify above here*/",
+ " /*Don't modify above this line*/",
" ",
" ",
" ",
- " /*Don't modify below here*/",
+ " /*Don't modify below this line*/",
" ",
" if(slotOne != slotTwo || slotTwo != slotThree){",
" return(null);",
@@ -1560,157 +1622,157 @@
"assert(editor.match(/slotThree/gi) && editor.match(/slotThree/gi).length >= 7, 'You should have used the slotThree value at least once');"
],
"challengeSeed":[
- "fccss",
- " function runSlots(){",
- " var slotOne;",
- " var slotTwo;",
- " var slotThree;",
- " ",
- " //Placeholder",
- " var images = ['https://www.evernote.com/l/AlxaOC8QrXlBjpTdGMe3mBwLN3Yjm-KB5yQB/image.png','https://www.evernote.com/l/AlyXbeIS8axEspbwXD8RzmsaCUIf10snmzgB/image.png','https://www.evernote.com/l/AlxMveeWtopKaajUmTVrnv92mqA_s2uzW-8B/image.png','https://www.evernote.com/l/AlyyRP_Kh_dCG7t8b4JRnwMNCa1JThI_5gQB/image.png', 'https://www.evernote.com/l/Alx64952qUxEhJnBteZvJgxib1qlwQcw9G0B/image.png'];",
- " ",
- " slotOne = Math.floor(Math.random() * (5 - 1 + 1)) + 1;",
- " slotTwo = Math.floor(Math.random() * (5 - 1 + 1)) + 1;",
- " slotThree = Math.floor(Math.random() * (5 - 1 + 1)) + 1;",
- " ",
- " $('.logger').html('');",
- " $('.logger').html('Not A Win')",
- " ",
- " /*Don't modify above here*/",
- " ",
- " ",
- " ",
- " /*Don't modify below here*/",
- " ",
- " if(slotOne != slotTwo || slotTwo != slotThree){",
- " return(null);",
- " }",
- " ",
- " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
- " $('.logger').html(slotOne);",
- " $('.logger').append(' ' + slotTwo);",
- " $('.logger').append(' ' + slotThree);",
- " }",
- " ",
- " return([slotOne, slotTwo, slotThree]);",
- " }",
- "",
- " $(document).ready(function(){",
- " $('.go').click(function(){",
- " runSlots();",
- " });",
- " });",
- "fcces",
- " ",
- "
button
elements bounce. Just add this code inside your \"document ready function\": $(\"button\").addClass(\"animated bounce\")
."
],
"tests": [
- "assert($(\"button\").hasClass(\"animated\") && $(\"button\").hasClass(\"bounce\"), 'Use the jQuery addClass()
function to give the classes \"animated\" and \"bounce\" to your button
element.')",
+ "assert($(\"button\").hasClass(\"animated\") && $(\"button\").hasClass(\"bounce\"), 'Use the jQuery addClass()
function to give the classes \"animated\" and \"bounce\" to your button
elements.')",
"assert(!editor.match(/class.*animated/g), 'Only use jQuery to add these classes to the element.')"
],
"challengeSeed": [
@@ -108,7 +108,7 @@
"First, let's target your div
elements with the class \"well\" by using the $(\".well\")
selector.",
"Note that, just like with CSS declarations, you type a .
before the class's name.",
"Then use jQuery's .addClass()
function to add the classes \"animated\" and \"shake\".",
- "Here's the full code that you'll want to type into your \"document ready function\": $(\".well\").addClass(\"animated shake\");
"
+ "For example, you could make all the elements with the class \"text-primary\" shake by adding the following to your \"document ready function\": $(\".text-primary\").addClass(\"animated shake\");
"
],
"tests": [
"assert($(\".well\").hasClass(\"animated\") && $(\".well\").hasClass(\"shake\"), 'Use the jQuery addClass()
function to give the classes \"animated\" and \"shake\" to all your elements with the class \"well\".')",
@@ -157,12 +157,12 @@
"First target your div
element with the id \"target3\" by using the $(\"#target3\")
selector.",
"Note that, just like with CSS declarations, you type a #
before the id's name.",
"Then use jQuery's .addClass()
function to add the classes \"animated\" and \"fadeOut\".",
- "Make all the button
element with the id \"target3\" fadeOut. $(\"#target3\").addClass(\"animated fadeOut\")
."
+ "Here's how you'd make the button
element with the id \"target6\" fade out: $(\"#target6\").addClass(\"animated fadeOut\")
."
],
"tests": [
"assert($(\"#target3\").hasClass(\"animated\"), 'Select the button
element with the id
of \"target3\" and use the jQuery addClass()
function to give it the class of \"animated\".');",
- "assert($(\"#target3\").hasClass(\"fadeOut\"), 'Target the element with the id target3
and use the jQuery addClass()
function to give it the class \"fadeOut\".')",
- "assert(!editor.match(/class.*animated/g), 'Only use jQuery to add these classes to the element.');"
+ "assert($(\"#target3\").hasClass(\"fadeOut\") || $(\"#target3\").hasClass(\"fadeout\"), 'Target the element with the id target3
and use the jQuery addClass()
function to give it the class \"fadeOut\".')",
+ "assert(!editor.match(/class.*animated/g), 'Only use jQuery to add these classes to the element.')"
],
"challengeSeed": [
"fccss",
@@ -262,9 +262,9 @@
"Use the addClass()
jQuery function to give the element one new class for each selector: \"animated\", \"shake\", and \"btn-primary\"."
],
"tests": [
- "assert(editor.match(/\\$\\((\"button\"\\)/g), 'Use the $(\"button\")
selector.')",
- "assert(editor.match(/\\$\\(\"\\.btn\"\\)/g), 'Use the $(\".btn\"\\)
selector.')",
- "assert(editor.match(/\\$\\(\"#target1\"\\)/g), 'Use the $(\"#target1\")
selector.')",
+ "assert(editor.match(/\\$\\(.*button/g), 'Use the $(\"button\")
selector.')",
+ "assert(editor.match(/\\$\\(.*.btn/g), 'Use the $(\".btn\")
selector.')",
+ "assert(editor.match(/\\$\\(.*#target1/g), 'Use the $(\"#target1\")
selector.')",
"assert(editor.match(/addClass/g) && editor.match(/addClass/g).length > 2, 'Only add one class with each of your three selectors.')",
"assert($(\"#target1\").hasClass(\"animated\") && $(\"#target1\").hasClass(\"shake\") && $(\"#target1\").hasClass(\"btn-primary\"), 'Your \"#target1\" element should have the classes \"animated\" \"shake\" and \"btn-primary\".')",
"assert(!editor.match(/class.*animated/g), 'Only use jQuery to add these classes to the element.')"
@@ -624,7 +624,7 @@
"Here's an example of how you would use the parent()
function: $(\"#left-well\").parent().css(\"background-color\", \"blue\")
"
],
"tests": [
- "assert($(\"#left-well\").css(\"background-color\") === 'rgb(255, 0, 0)', 'Your \"target1\" element should have a red background.')",
+ "assert($(\"#left-well\").css(\"background-color\") === 'rgb(255, 0, 0)', 'Your \"left-well\" element should have a red background.')",
"assert(editor.match(/\\.parent\\(\\)\\.css/g), 'You should use the parent()
function to modify this element.')",
"assert(editor.match(/body
element, and your \"jQuery Playground\" h3
element is a child of your <div class=\"container-fluid\">
element.",
"jQuery has a function called children()
that allows you to access the children of whichever element you've selected.",
"Give all the children of your #right-well
element a color of green.",
@@ -792,7 +792,7 @@
"tests": [
"assert($('.target:even').hasClass('animated') && $('.target:even').hasClass('shake'), 'All the \"target\" elements that computer considers even should shake.')",
"assert(editor.match(/\\:even/g), 'You should use the :even
function to modify these elements.')",
- "assert(editor.match(/