diff --git a/public/json/cats.json b/public/json/cats.json
index 209e8ae685..84d9d1b243 100644
--- a/public/json/cats.json
+++ b/public/json/cats.json
@@ -1,7 +1,7 @@
[
{
"id": 0,
- "imageLink": "http://rs611.pbsrc.com/albums/tt194/allypopper423/Funny-Cat-Green-Avacado.jpg~c200",
+ "imageLink": "https://s3.amazonaws.com/freecodecamp/funny-cat.jpg",
"codeNames": [
"Juggernaut",
"Mrs. Wallace",
@@ -10,7 +10,7 @@
},
{
"id": 1,
- "imageLink": "http://cdn.grumpycats.com/wp-content/uploads/2012/09/GC-Gravatar-copy.png",
+ "imageLink": "https://s3.amazonaws.com/freecodecamp/grumpy-cat.jpg",
"codeNames": [
"Oscar",
"Scrooge",
@@ -19,7 +19,7 @@
},
{
"id": 2,
- "imageLink": "http://www.kittenspet.com/wp-content/uploads/2012/08/cat_with_funny_face_3-200x200.jpg",
+ "imageLink": "https://s3.amazonaws.com/freecodecamp/mischievous-cat.jpg",
"codeNames": [
"The Doctor",
"Loki",
diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json
index 68646b02e4..dc6b2427f1 100644
--- a/seed/challenges/basic-javascript.json
+++ b/seed/challenges/basic-javascript.json
@@ -38,7 +38,7 @@
"For now 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(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');"
],
"challengeSeed": [
@@ -65,7 +65,7 @@
"Look at the ourName
example if you get stuck."
],
"tests": [
- "assert((function(){/**/if(typeof(myName) !== 'undefined' && typeof(myName) == 'string' && myName.length > 0){return(true);}else{return(false);}/**/})(), 'myName should be a string that contains at least one character in it');"
+ "assert((function(){/**/if(typeof(myName) !== \"undefined\" && typeof(myName) == \"string\" && myName.length > 0){return(true);}else{return(false);}/**/})(), 'myName should be a string that contains at least one character in it');"
],
"challengeSeed": [
"// var ourName = \"Free Code Camp\";",
@@ -74,7 +74,7 @@
"// We use this to show you the value of your variable in your output box.",
"// We'll learn about functions soon.",
"",
- "if(typeof(myName) !== 'undefined'){(function(v){return(v);})(myName);}"
+ "if(typeof(myName) !== \"undefined\"){(function(v){return(v);})(myName);}"
],
"type": "waypoint",
"challengeType": 1
@@ -89,8 +89,8 @@
"You can assign these variables to be 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');",
- "assert((function(){if(typeof(myLastName) !== 'undefined' && typeof(myLastName) == 'string' && myLastName.length > 0){return(true);}else{return(false);}})(), 'myLastName should be a string with a least one character in it');"
+ "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');",
+ "assert((function(){if(typeof(myLastName) !== \"undefined\" && typeof(myLastName) == \"string\" && myLastName.length > 0){return(true);}else{return(false);}})(), 'myLastName should be a string with a least one character in it');"
],
"challengeSeed": [
"// ourName = \"Free Code Camp\";",
@@ -101,7 +101,7 @@
"// 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.",
- "if(typeof(myFirstName) !== 'undefined' && typeof(myLastName) !== 'undefined'){(function(y,z){return(y + ', ' + z);})(myFirstName, myLastName);}"
+ "if(typeof(myFirstName) !== \"undefined\" && typeof(myLastName) !== \"undefined\"){(function(y,z){return(y + ', ' + z);})(myFirstName, myLastName);}"
],
"type": "waypoint",
"challengeType": 1
@@ -115,7 +115,7 @@
"For example, if we created a variable var firstName = \"Julie\"
, we could find out how long the string \"Julie\" is by using the firstName.length
property."
],
"tests": [
- "assert((function(){if(typeof(lastNameLength) != 'undefined' && typeof(lastNameLength) == 'number' && lastNameLength == 4){return(true);}else{return(false);}})(), 'lastNameLength should be equal to four')",
+ "assert((function(){if(typeof(lastNameLength) != \"undefined\" && typeof(lastNameLength) == \"number\" && lastNameLength == 4){return(true);}else{return(false);}})(), 'lastNameLength should be equal to four')",
"assert((function(){if(editor.getValue().match(/\\.length/gi) && editor.getValue().match(/\\.length/gi).length >= 2 && editor.getValue().match(/var lastNameLength \\= 0;/gi) && editor.getValue().match(/var lastNameLength \\= 0;/gi).length >= 1){return(true);}else{return(false);}})(), 'You should be getting the length of lastName
by using .length
like this: lastName.length
');"
],
"challengeSeed": [
@@ -134,7 +134,7 @@
"// 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.",
- "if(typeof(lastNameLength) != 'undefined'){(function(v){return(v);})(lastNameLength);}"
+ "if(typeof(lastNameLength) != \"undefined\"){(function(v){return(v);})(lastNameLength);}"
],
"type": "waypoint",
"challengeType": 1
@@ -151,7 +151,7 @@
"Try looking at the firstLetterOfFirstName
variable declaration if you get stuck."
],
"tests": [
- "assert((function(){if(typeof(firstLetterOfLastName) != 'undefined' && editor.getValue().match(/\\[0\\]/gi) && typeof(firstLetterOfLastName) == 'string' && firstLetterOfLastName == 'C'){return(true);}else{return(false);}})(), 'The first letter of firstLetterOfLastName should be a C');"
+ "assert((function(){if(typeof(firstLetterOfLastName) != \"undefined\" && editor.getValue().match(/\\[0\\]/gi) && typeof(firstLetterOfLastName) == \"string\" && firstLetterOfLastName == \"C\"){return(true);}else{return(false);}})(), 'The first letter of firstLetterOfLastName should be a C');"
],
"challengeSeed": [
"var firstLetterOfLastName = \"\"",
@@ -185,7 +185,7 @@
"Try looking at the secondLetterOfFirstName
variable declaration if you get stuck."
],
"tests": [
- "assert(thirdLetterOfLastName == 'e', 'The third last letter of lastName should be an e');"
+ "assert(thirdLetterOfLastName == \"e\", 'The third last letter of lastName should be an e');"
],
"challengeSeed": [
"var firstName = \"Madeline\";",
@@ -217,7 +217,7 @@
"Try looking at the lastLetterOfLastName
variable declaration if you get stuck."
],
"tests": [
- "assert(lastLetterOfLastName == 'n', 'lastLetterOfLastName should be n
');",
+ "assert(lastLetterOfLastName == \"n\", 'lastLetterOfLastName should be n
');",
"assert(editor.getValue().match(/\\.length/g), 'You have to use .length to get the last letter');"
],
"challengeSeed": [
@@ -247,7 +247,7 @@
"Try looking at the lastLetterOfLastName
variable declaration if you get stuck."
],
"tests": [
- "assert(secondToLastLetterOfLastName == 'e', 'secondToLastLetterOfLastName should be e');",
+ "assert(secondToLastLetterOfLastName == \"e\", 'secondToLastLetterOfLastName should be e');",
"assert(editor.getValue().match(/\\.length/g), 'You have to use .length to get the third last letter');"
],
"challengeSeed": [
@@ -366,7 +366,7 @@
"Let's create a variable myDecimal
and give it a decimal value."
],
"tests": [
- "assert((function(){if(typeof(myDecimal) != 'undefined' && typeof(myDecimal) == 'number' && editor.getValue().match(/\\./g).length >=2){return(true);}else{return(false);}})(), 'myDecimal should be a decimal point number');"
+ "assert((function(){if(typeof(myDecimal) != \"undefined\" && typeof(myDecimal) == \"number\" && editor.getValue().match(/\\./g).length >=2){return(true);}else{return(false);}})(), 'myDecimal should be a decimal point number');"
],
"challengeSeed": [
"//var ourDecimal = 5.7",
@@ -375,7 +375,7 @@
"",
"",
"",
- "(function(){if(typeof(myDecimal) != 'undefined'){return(myDecimal);}})();"
+ "(function(){if(typeof(myDecimal) != \"undefined\"){return(myDecimal);}})();"
],
"type": "waypoint",
"challengeType": 1
@@ -414,12 +414,12 @@
""
],
"tests": [
- "assert(typeof(myArray) == 'object', 'myArray should be an array');",
- "assert(typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) == 'string', 'The fist item in myArray should be a string');",
- "assert(typeof(myArray[1]) !== 'undefined' && typeof(myArray[1]) == 'number', 'The second item in myArray should be a number');"
+ "assert(typeof(myArray) == \"object\", 'myArray should be an array');",
+ "assert(typeof(myArray[0]) !== \"undefined\" && typeof(myArray[0]) == \"string\", 'The fist item in myArray should be a string');",
+ "assert(typeof(myArray[1]) !== \"undefined\" && typeof(myArray[1]) == \"number\", 'The second item in myArray should be a number');"
],
"challengeSeed": [
- "//var array = ['John', 23];",
+ "//var array = [\"John\", 23];",
"",
"var myArray = [];",
"",
@@ -438,13 +438,13 @@
"Let's now go create a nested array called myArray
"
],
"tests":[
- "assert((function(){if(typeof(myArray) !== 'undefined' && typeof(myArray) === 'object' && typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) === 'object' && editor.getValue().match(/\\[\\[/g).length >= 1 && editor.getValue().match(/\\]\\]/g).length >= 1){return(true);}else{return(false);}})(), 'myArray should contain at least one array');"
+ "assert((function(){if(typeof(myArray) !== \"undefined\" && typeof(myArray) === \"object\" && typeof(myArray[0]) !== \"undefined\" && typeof(myArray[0]) === \"object\" && editor.getValue().match(/\\[\\[/g).length >= 1 && editor.getValue().match(/\\]\\]/g).length >= 1){return(true);}else{return(false);}})(), 'myArray should contain at least one array');"
],
"challengeSeed":[
"var myArray = [];",
"",
"",
- "if(typeof(myArray) !== 'undefined'){(function(){return(myArray);})();}"
+ "if(typeof(myArray) !== \"undefined\"){(function(){return(myArray);})();}"
],
"type": "waypoint",
"challengeType": 1
@@ -464,7 +464,7 @@
"Create a var called data
and set it to equal the first value of myArray
"
],
"tests":[
- "assert((function(){if(typeof(myArray) != 'undefined' && typeof(data) != 'undefined' && myArray[0] == data){return(true);}else{return(false);}})(), 'the variable data should equal the first value of myArray');"
+ "assert((function(){if(typeof(myArray) != \"undefined\" && typeof(data) != \"undefined\" && myArray[0] == data){return(true);}else{return(false);}})(), 'the variable data should equal the first value of myArray');"
],
"challengeSeed":[
"//var ourArray = [1,2,3]",
@@ -474,7 +474,7 @@
"",
"",
"",
- "if(typeof(myArray) != 'undefined' && typeof(data) != 'undefined'){(function(y,z){return('myArray = ' + JSON.stringify(y) + ', data = ' + JSON.stringify(z));})(myArray, data);}"
+ "if(typeof(myArray) != \"undefined\" && typeof(data) != \"undefined\"){(function(y,z){return('myArray = ' + JSON.stringify(y) + ', data = ' + JSON.stringify(z));})(myArray, data);}"
],
"type": "waypoint",
"challengeType": 1
@@ -494,7 +494,7 @@
""
],
"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]');",
+ "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]');",
"assert((function(){if(editor.getValue().match(/[0]/g).length >= 2 && editor.getValue().match(/=/g).length >= 2){return(true);}else{return(false);}})(), 'You should be using indexes to modify the values in myArray');"
],
"challengeSeed":[
@@ -506,7 +506,7 @@
"",
"",
"",
- "if(typeof(myArray) != 'undefined'){(function(){return(myArray);})();}"
+ "if(typeof(myArray) != \"undefined\"){(function(){return(myArray);})();}"
],
"type": "waypoint",
"challengeType": 1
@@ -523,8 +523,8 @@
"Let's try .pop()
now"
],
"tests": [
- "assert((function(d){if(d[0] == 'John' && d[1] == 23 && d[2] == undefined){return(true);}else{return(false);}})(myArray), 'myArray should only have the first two values left([\"John\", 23])');",
- "assert((function(d){if(d[0] == 'cat' && d[1] == 2 && d[2] == undefined){return(true);}else{return(false);}})(removed), 'myArray should only have the first two values left([\"cat\"], 2)');"
+ "assert((function(d){if(d[0] == \"John\" && d[1] == 23 && d[2] == undefined){return(true);}else{return(false);}})(myArray), 'myArray should only have the first two values left([\"John\", 23])');",
+ "assert((function(d){if(d[0] == \"cat\" && d[1] == 2 && d[2] == undefined){return(true);}else{return(false);}})(removed), 'myArray should only have the first two values left([\"cat\"], 2)');"
],
"challengeSeed": [
"//var numbers = [1,2,3];",
@@ -533,8 +533,8 @@
"//console.log(numbers); //Gives [1,2]",
"//console.log(removed); //Gives 3",
"",
- "var myArray = ['John', 23, ['cat', 2]];",
- "var removed = myArray;//This should be ['cat', 2] and myArray should now be ['John', 23]",
+ "var myArray = [\"John\", 23, [\"cat\", 2]];",
+ "var removed = myArray;//This should be [\"cat\", 2] and myArray should now be [\"John\", 23]",
"",
"",
"(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z));})(myArray, removed);"
@@ -548,15 +548,15 @@
"difficulty": "9.9818",
"description": [
"Now that we've learned how to pop
things from the end of the array, we need to learn how to push
stuff back to the end",
- "Let's take the code we had last time and push
this value to the end: ['dog', 3]
"
+ "Let's take the code we had last time and push
this value to the end: [\"dog\", 3]
"
],
"tests": [
- "assert((function(d){if(d[2] != undefined && d[0] == 'John' && d[1] == 23 && d[2][0] == 'dog' && d[2][1] == 3 && d[2].length == 2){return(true);}else{return(false);}})(myArray), 'myArray should only have the first two values left([\"John\", 23, [\"dog\", 3]])');"
+ "assert((function(d){if(d[2] != undefined && d[0] == \"John\" && d[1] == 23 && d[2][0] == \"dog\" && d[2][1] == 3 && d[2].length == 2){return(true);}else{return(false);}})(myArray), 'myArray should only have the first two values left([\"John\", 23, [\"dog\", 3]])');"
],
"challengeSeed": [
- "var myArray = ['John', 23, ['cat', 2]];",
+ "var myArray = [\"John\", 23, [\"cat\", 2]];",
"var removed = myArray.pop();",
- "//Add a ['dog', 3] to the end of myArray using push",
+ "//Add a [\"dog\", 3] to the end of myArray using push",
"",
"",
"(function(z){return('myArray = ' + JSON.stringify(z));})(myArray);"
@@ -574,12 +574,12 @@
"Let's try .shift()
now"
],
"tests": [
- "assert((function(d){if(d[0] == 23 && d[1][0] == 'dog' && d[1][1] == 3 && d[2] == undefined){return(true);}else{return(false);}})(myArray), 'myArray should only have the first two values left([\"John\", 23])');",
- "assert((function(d){if(d === 'John' && typeof(removed) === 'string'){return(true);}else{return(false);}})(removed), 'Removed should contain \"John\"');"
+ "assert((function(d){if(d[0] == 23 && d[1][0] == \"dog\" && d[1][1] == 3 && d[2] == undefined){return(true);}else{return(false);}})(myArray), 'myArray should only have the first two values left([\"John\", 23])');",
+ "assert((function(d){if(d === \"John\" && typeof(removed) === \"string\"){return(true);}else{return(false);}})(removed), 'Removed should contain \"John\"');"
],
"challengeSeed": [
- "var myArray = ['John', 23, ['dog', 3]];",
- "var removed = myArray;//This should be ['John'] and myArray should now be [23, ['dog', 3]]",
+ "var myArray = [\"John\", 23, [\"dog\", 3]];",
+ "var removed = myArray;//This should be [\"John\"] and myArray should now be [23, [\"dog\", 3]]",
"",
"",
"(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z));})(myArray, removed);"
@@ -593,15 +593,15 @@
"difficulty": "9.9818",
"description": [
"Now that we've learned how to shift
things from the start of the array, we need to learn how to unshift
stuff back to the start",
- "Let's take the code we had last time and unshift
this value to the end: 'Paul'
"
+ "Let's take the code we had last time and unshift
this value to the end: \"Paul\"
"
],
"tests": [
- "assert((function(d){if(d[0].toLowerCase() == 'paul' && d[1] == 23 && d[2][0] != undefined && d[2][0] == 'dog' && d[2][1] != undefined && d[2][1] == 3){return(true);}else{return(false);}})(myArray), 'myArray should now have [\"Paul\", 23, [\"dog\", 3]])');"
+ "assert((function(d){if(d[0].toLowerCase() == \"paul\" && d[1] == 23 && d[2][0] != undefined && d[2][0] == \"dog\" && d[2][1] != undefined && d[2][1] == 3){return(true);}else{return(false);}})(myArray), 'myArray should now have [\"Paul\", 23, [\"dog\", 3]])');"
],
"challengeSeed": [
- "var myArray = ['John', 23, ['dog', 3]];",
- "var removed = myArray.shift();//This should be 'John' and myArray should now be [23, ['dog', 3]]",
- "//Add 'Paul' to the start of myArray",
+ "var myArray = [\"John\", 23, [\"dog\", 3]];",
+ "var removed = myArray.shift();//This should be \"John\" and myArray should now be [23, [\"dog\", 3]]",
+ "//Add \"Paul\" to the start of myArray",
"",
"",
"(function(y, z){return('myArray = ' + JSON.stringify(y));})(myArray);"
@@ -626,7 +626,7 @@
"Let's try creating and calling a function now called myFunction
"
],
"tests":[
- "assert((function(){if(typeof(f) !== 'undefined' && typeof(f) === 'number' && f === a + b && editor.getValue().match(/return/gi).length >= 1 && editor.getValue().match(/a/gi).length >= 1 && editor.getValue().match(/b/gi).length >= 1 && editor.getValue().match(/\\+/gi).length >= 1){return(true);}else{return(false);}})(), 'Your function should return the value of a + b');"
+ "assert((function(){if(typeof(f) !== \"undefined\" && typeof(f) === \"number\" && f === a + b && editor.getValue().match(/return/gi).length >= 1 && editor.getValue().match(/a/gi).length >= 1 && editor.getValue().match(/b/gi).length >= 1 && editor.getValue().match(/\\+/gi).length >= 1){return(true);}else{return(false);}})(), 'Your function should return the value of a + b');"
],
"challengeSeed":[
"var a = 4;",
@@ -638,7 +638,7 @@
"",
"",
"//Don't modify this!",
- "if(typeof(myFunction) != 'undefined'){",
+ "if(typeof(myFunction) != \"undefined\"){",
"var f=myFunction(a,b);",
"(function(){return(f);})();",
"}"
@@ -666,17 +666,17 @@
"Let's try to make an Object that represents a dog called myDog!"
],
"tests":[
- "assert((function(z){if(z.hasOwnProperty('name') && z.name != undefined && typeof(z.name) == 'string'){return(true);}else{return(false);}})(myDog), 'myDog should contain the property name and it should be a string');",
- "assert((function(z){if(z.hasOwnProperty('legs') && z.legs != undefined && typeof(z.legs) == 'number'){return(true);}else{return(false);}})(myDog), 'myDog should contain the property legs and it should be a number');",
- "assert((function(z){if(z.hasOwnProperty('tails') && z.tails != undefined && typeof(z.tails) == 'number'){return(true);}else{return(false);}})(myDog), 'myDog should contain the property tails and it should be a number');",
- "assert((function(z){if(z.hasOwnProperty('friends') && z.friends != undefined && Array.isArray(z.friends)){return(true);}else{return(false);}})(myDog), 'myDog should contain the property friends and it should be an array');"
+ "assert((function(z){if(z.hasOwnProperty(\"name\") && z.name != undefined && typeof(z.name) == \"string\"){return(true);}else{return(false);}})(myDog), 'myDog should contain the property name and it should be a string');",
+ "assert((function(z){if(z.hasOwnProperty(\"legs\") && z.legs != undefined && typeof(z.legs) == \"number\"){return(true);}else{return(false);}})(myDog), 'myDog should contain the property legs and it should be a number');",
+ "assert((function(z){if(z.hasOwnProperty(\"tails\") && z.tails != undefined && typeof(z.tails) == \"number\"){return(true);}else{return(false);}})(myDog), 'myDog should contain the property tails and it should be a number');",
+ "assert((function(z){if(z.hasOwnProperty(\"friends\") && z.friends != undefined && Array.isArray(z.friends)){return(true);}else{return(false);}})(myDog), 'myDog should contain the property friends and it should be an array');"
],
"challengeSeed":[
"//var ourDog = {",
"// \"name\": \"Camper\"",
"// \"legs\": 4",
"// \"tails\": 1",
- "// \"friends\": ['everything!']",
+ "// \"friends\": [\"everything!\"]",
"//};",
"",
"/* add the name(string), legs(number), tails(number) and friends(array) properties to myDog.",
@@ -719,7 +719,7 @@
"//Re-create myDog",
"",
"var myDog = {",
- " \"name\": 'Camper',",
+ " \"name\": \"Camper\",",
" \"legs\": 4,",
" \"tails\": 1,",
" \"friends\": []",
@@ -835,7 +835,7 @@
"Let's have a go of Math.random()
now be getting myFunction
to return a random number"
],
"tests":[
- "assert(typeof(myFunction()) === 'number', 'myFunction should return a random number');",
+ "assert(typeof(myFunction()) === \"number\", 'myFunction should return a random number');",
"assert((myFunction()+''). match(/\\./g), 'The number returned by myFunction should be a decimal');",
"assert(editor.getValue().match(/Math\\.random/g).length >= 2, 'You should be using Math.random to generate the random decimal number');"
],
@@ -864,7 +864,7 @@
"Let's give this technique a go now"
],
"tests":[
- "assert(typeof(myFunction()) == 'number', 'The result of myFunction should be a number');",
+ "assert(typeof(myFunction()) == \"number\", 'The result of myFunction should be a number');",
"assert(editor.getValue().match(/Math.random/g), 'You should be using Math.random to create a random number');",
"assert(!(''+myFunction()).match(/\\./g), 'You should have multiplied the result of Math.random but 10 to make it a number that\\'s greater then zero');",
"assert(editor.getValue().match(/Math.floor/g), 'You should use Math.floor to remove the decimal part of the number');"
@@ -926,7 +926,7 @@
"Create an if else statement to return heads
if the flip var is zero and to return tails
if it's not"
],
"tests":[
- "assert((function(){if(myFunction() == 'heads' || myFunction() == 'tails'){return(true);}else{return(false);}})(), 'myFunction should either return heads or tails');",
+ "assert((function(){if(myFunction() == \"heads\" || myFunction() == \"tails\"){return(true);}else{return(false);}})(), 'myFunction should either return heads or tails');",
"assert(editor.getValue().match(/if/g).length >= 3, 'You should have created a new if statement');",
"assert(editor.getValue().match(/else/g).length >= 2, 'You should have created a new else statement');"
],
@@ -1077,9 +1077,9 @@
"Math.floor(Math.random() * (5 - 1 + 1)) + 1;
"
],
"tests":[
- "assert(typeof(runSlots($('.slot'))[0]) == 'number', 'slotOne should be a random number');",
- "assert(typeof(runSlots($('.slot'))[1]) == 'number', 'slotTwo should be a random number');",
- "assert(typeof(runSlots($('.slot'))[2]) == 'number', 'slotThree should be a random number');",
+ "assert(typeof(runSlots($(\".slot\"))[0]) == \"number\", 'slotOne should be a random number');",
+ "assert(typeof(runSlots($(\".slot\"))[1]) == \"number\", 'slotTwo should be a random number');",
+ "assert(typeof(runSlots($(\".slot\"))[2]) == \"number\", 'slotThree should be a random number');",
"assert((function(){if(editor.match(/Math\\.floor\\(\\s?Math\\.random\\(\\)\\s?\\*\\s?\\(\\s?5\\s?\\-\\s?1\\s?\\+\\s?1\\s?\\)\\s?\\)\\s?\\+\\s?1;/gi) !== null){return(editor.match(/Math\\.floor\\(\\s?Math\\.random\\(\\)\\s?\\*\\s?\\(\\s?5\\s?\\-\\s?1\\s?\\+\\s?1\\s?\\)\\s?\\)\\s?\\+\\s?1;/gi).length >= 3);}else{return(false);}})(), 'You should have used Math.floor(Math.random() * (5 - 1 + 1)) + 1; three times to generate your random numbers');"
],
"challengeSeed":[
@@ -1089,7 +1089,7 @@
" var slotTwo;",
" var slotThree;",
" ",
- " var images = ['http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens'];",
+ " 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*/",
" ",
@@ -1097,48 +1097,48 @@
" ",
" /*Don't modify below here*/",
" ",
- " $('.logger').html('');",
- " $('.logger').html('Not A Win')",
+ " $(\".logger\").html(\"\");",
+ " $(\".logger\").html(\"Not A Win\")",
" ",
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
- " $('.logger').html(slotOne + ' ' + slotTwo + ' ' + slotThree);",
+ " $(\".logger\").html(slotOne + \" \" + slotTwo + \" \" + slotThree);",
" }",
" return([slotOne, slotTwo, slotThree]);",
" }",
"",
" $(document).ready(function(){",
- " $('.go').click(function(){",
+ " $(\".go\").click(function(){",
" runSlots();",
" });",
" });",
"fcces",
" ",
"
$('.slot')
to select all of the slots",
+ "We're going to use the jQuery selector $(\".slot\")
to select all of the slots",
"Once they are all selected we can use bracket notation to access each individual one like this",
- "$($('.slot')[0]).html('')
",
+ "$($(\".slot\")[0]).html(\"\")
",
"This will grab the the first slot so that we can add the numbers we generate to them",
"Use the above selector to display each number in the corresponding slot"
],
"tests":[
- "assert((function(){runSlots();if($($('.slot')[0]).html().replace(/\\s/gi, '') !== '' && $($('.slot')[1]).html().replace(/\\s/gi, '') !== '' && $($('.slot')[2]).html().replace(/\\s/gi, '') !== ''){return(true);}else{return(false);}})(), 'You should be displaying the result of the slot numbers in the corresponding slots');",
- "assert((function(){if(editor.match( /\\$\\(\\$\\(\\'\\.slot\\'\\)\\[\\d\\]\\)/gi )){if(editor.match( /\\$\\(\\$\\(\\'\\.slot\\'\\)\\[\\d\\]\\)/gi ).length >= 3 && editor.match( /\\.html\\(slotOne\\);/gi ) && editor.match( /\\.html\\(slotTwo\\);/gi ) && editor.match( /\\.html\\(slotThree\\);/gi )){return(true);}else{return(false);}}else{return(false);}})(), 'You should have used the the selector given in the description to select each slot and assign it the value of slotOne, slotTwo and slotThree respectively');"
+ "assert((function(){runSlots();if($($(\".slot\")[0]).html().replace(/\\s/gi, \"\") !== \"\" && $($(\".slot\")[1]).html().replace(/\\s/gi, \"\") !== \"\" && $($(\".slot\")[2]).html().replace(/\\s/gi, \"\") !== \"\"){return(true);}else{return(false);}})(), 'You should be displaying the result of the slot numbers in the corresponding slots');",
+ "assert((function(){if(editor.match( /\\$\\(\\$\\(\\\"\\.slot\\\"\\)\\[\\d\\]\\)/gi )){if(editor.match( /\\$\\(\\$\\(\\\"\\.slot\\\"\\)\\[\\d\\]\\)/gi ).length >= 3 && editor.match( /\\.html\\(slotOne\\);/gi ) && editor.match( /\\.html\\(slotTwo\\);/gi ) && editor.match( /\\.html\\(slotThree\\);/gi )){return(true);}else{return(false);}}else{return(false);}})(), 'You should have used the the selector given in the description to select each slot and assign it the value of slotOne, slotTwo and slotThree respectively');"
],
"challengeSeed":[
"fccss",
@@ -1402,14 +1402,14 @@
" var slotThree;",
" ",
" //Placeholder",
- " var images = ['http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens','http://bit.ly/fcc-kittens'];",
+ " 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\"];",
" ",
" 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')",
+ " $(\".logger\").html(\"\");",
+ " $(\".logger\").html(\"Not A Win\")",
" ",
" /*Don't modify above here*/",
" ",
@@ -1422,47 +1422,47 @@
" }",
" ",
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
- " $('.logger').html(slotOne);",
- " $('.logger').append(' ' + slotTwo);",
- " $('.logger').append(' ' + slotThree);",
+ " $(\".logger\").html(slotOne);",
+ " $(\".logger\").append(\" \" + slotTwo);",
+ " $(\".logger\").append(\" \" + slotThree);",
" }",
" ",
" return([slotOne, slotTwo, slotThree]);",
" }",
"",
" $(document).ready(function(){",
- " $('.go').click(function(){",
+ " $(\".go\").click(function(){",
" runSlots();",
" });",
" });",
"fcces",
" ",
"Responsive Design
.",
"With responsive design, there is no need to design a mobile version of your website. It will look good on devices with screens of any width.",
- "You can add Bootstrap to any app just by including it with <link rel='stylesheet' href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css'/>
at the top of your HTML. But we've gone ahead and automatically added it to your Cat Photo App for you.",
+ "You can add Bootstrap to any app just by including it with <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css\"/>
at the top of your HTML. But we've gone ahead and automatically added it to your Cat Photo App for you.",
"To get started, we should nest all of our HTML in a div
element with the class \"container-fluid\"."
],
"tests": [
- "assert($('div').hasClass('container-fluid'), 'Your div
element should have the class \"container-fluid\"')",
+ "assert($(\"div\").hasClass(\"container-fluid\"), 'Your div
element should have the class \"container-fluid\"')",
"assert(editor.match(/<\\/div>/g) && editor.match(/Click here for cat photos.
", + "Click here for cat photos.
", "", - "Things cats love:
", "src
attribute to \"http://bit.ly/fcc-kittens2\".",
+ "First, Add a new image below the existing one. Set it's src
attribute to \"http://bit.ly/fcc-running-cats\".",
"It would be great if this image could be exactly the width of our phone's screen.",
"Fortunately, with Bootstrap, all we need to do is add the \"img-responsive\" class to your image. Do this, and the image should perfectly fit the width of your page."
],
"tests": [
- "assert($('img').length > 1, 'You should have a total of two images.')",
- "assert($('img').hasClass('img-responsive'), 'Your new image should have the class \"img-responsive\".')",
- "assert(new RegExp('http://bit.ly/fcc-kittens2', 'gi').test($('img.img-responsive').attr('src')), 'Add a second image with the src
of http://bit.ly/fcc-kittens2
.')"
+ "assert($(\"img\").length > 1, 'You should have a total of two images.')",
+ "assert($(\"img\").hasClass(\"img-responsive\"), 'Your new image should have the class \"img-responsive\".')",
+ "assert(new RegExp(\"http://bit.ly/fcc-running-cats\", \"gi\").test($(\"img.img-responsive\").attr(\"src\")), 'Add a second image with the src
of http://bit.ly/fcc-running-cats
.')"
],
"challengeSeed": [
- "",
+ "",
"",
"",
- "Click here for cat photos.
", + "Click here for cat photos.
", "", - "Things cats love:
", "<h2 class=\"text-red text-center\">your text</h2>
."
],
"tests": [
- "assert($('h2').hasClass('text-center'), 'Your h2
element should be centered by applying the class \"text-center\"')"
+ "assert($(\"h2\").hasClass(\"text-center\"), 'Your h2
element should be centered by applying the class \"text-center\"')"
],
"challengeSeed": [
- "",
+ "",
"",
"",
- "Click here for cat photos.
", + "Click here for cat photos.
", "", - "Things cats love:
", "button
element below your large kitten photo. Give it the class \"btn\" and the text of \"like this photo\"."
],
"tests": [
- "assert($('button').hasClass('btn'), 'Your new button should have the class \"btn\".')",
- "assert(new RegExp('like this photo','gi').test($('button.btn').text()), 'Your button should have the text \"like this photo\".')",
+ "assert($(\"button\").hasClass(\"btn\"), 'Your new button should have the class \"btn\".')",
+ "assert(new RegExp(\"like this photo\",\"gi\").test($(\"button.btn\").text()), 'Your button should have the text \"like this photo\".')",
"assert(editor.match(/<\\/button>/g) && editor.match(/Click here for cat photos.
", + "Click here for cat photos.
", "", - "Things cats love:
", "button
elements are only as wide as the text that they contain. By making them block elements, your button will stretch to fill your page's entire horizontal space.",
"This image illustrates the difference between \"inline\" elements and \"block-level\" elements:",
- "Click here for cat photos.
", + "Click here for cat photos.
", "", - "Things cats love:
", "Click here for cat photos.
", + "Click here for cat photos.
", "", - "Things cats love:
", "Click here for cat photos.
", + "Click here for cat photos.
", "", - "Things cats love:
", "Click here for cat photos.
", + "Click here for cat photos.
", "", - "Things cats love:
", "div
element.",
"Here's a diagram of how Bootstrap's 12-column grid layout works:",
- "col-md-*
class is being used. Here, \"md\" means \"medium\", and \"*\" is a number specifying how many columns wide the element should be. In this case, the column width of an element on a medium-sized screen, such as a laptop, is being specified.",
"In the Cat Photo App that we're building, we'll use col-xs-*
, where \"*\" is the number of columns wide the element should be, and \"xs\" means \"extra small\", like an extra-small mobile phone screen.",
"Put the \"Like\", \"Info\" and \"Delete\" buttons side-by-side by nesting all three of them within one <div class=\"row\">
element, then each of them within a <div class=\"col-xs-4\">
element.",
"The \"row\" class is applied to a div
, and the buttons themselves can be nested within it."
],
"tests": [
- "assert($('div.row:has(button)').length > 0, 'Your buttons should all be nested within the same div
element with the class \"row\".')",
- "assert($('div.col-xs-4:has(button)').length > 2, 'Each of your Bootstrap buttons should be nested within its own div
element with the class \"col-xs-4\".')",
+ "assert($(\"div.row:has(button)\").length > 0, 'Your buttons should all be nested within the same div
element with the class \"row\".')",
+ "assert($(\"div.col-xs-4:has(button)\").length > 2, 'Each of your Bootstrap buttons should be nested within its own div
element with the class \"col-xs-4\".')",
"assert(editor.match(/<\\/button>/g) && editor.match(/Click here for cat photos.
", + "Click here for cat photos.
", "", - "Things cats love:
", "style
element so that the only declarations left in your style
element are \"h2\" and \"thick-green-border\". Then Delete the p
element that contains a dead link. Then remove the \"red-text\" class from your h2
element and replace it with the \"text-primary\" Bootstrap class. Finally, remove the \"smaller-image\" class from your first img
element and replace it with the img-responsive
class."
+ ],
+ "tests": [
+ "assert(!$(\"h2\").hasClass(\"red-text\"), 'Your h2 element should no longer have the class \"red-text\".')",
+ "assert($(\"h2\").hasClass(\"text-primary\"), 'Your h2 element should now have the class \"text-primary\".')",
+ "assert(!$(\"p\").css(\"font-family\").match(/monospace/i), 'Your paragraph elements should no longer use the font \"Monospace\".')",
+ "assert(!$(\"img\").hasClass(\"smaller-image\"), 'Remove the \"smaller-image\" class from your top image.')",
+ "assert($(\".img-responsive\").length > 1, 'Add the \"img-responsive\" class to your top image.')"
+ ],
+ "challengeSeed": [
+ "",
+ "",
+ "",
+ "Click here for cat photos.
", + "", + "Things cats love:
", + "Top 3 things cats hate:
", + "style
element so that the only declarations left in your style
element are \"h2\" and \"thick-green-border\". Then Delete the p
element that contains a dead link. Then remove the \"red-text\" class from your h2
element and replace it with the \"text-primary\" Bootstrap class. Finally, remove the \"smaller-image\" class from your first img
element and replace it with the img-responsive
class."
+ "You can use use spans to create inline elements. Remember when we used the \"btn-block\" class to make the button grow fill the entire row?",
+ "This image illustrates the difference between \"inline\" elements and \"block-level\" elements:",
+ "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 withing 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>
"
],
"tests": [
- "assert(!$('h2').hasClass('red-text'), 'Your h2 element should no longer have the class \"red-text\".')",
- "assert($('h2').hasClass('text-primary'), 'Your h2 element should now have the class \"text-primary\".')",
- "assert(!$('p').css('font-family').match(/monospace/i), 'Your paragraph elements should no longer use the font \"Monospace\".')",
- "assert(!$('img').hasClass('smaller-image'), 'Remove the \"smaller-image\" class from your top image.')",
- "assert($('.img-responsive').length > 1, 'Add the \"img-responsive\" class to your top image.')"
+ "assert($(\"p span\") && $(\"p span\").length > 0, 'Your span
element should be inside your p
element.')",
+ "assert($(\"p span\") && $(\"p span\").text().match(/love/i), 'Your span
element should have the text \"love\".')",
+ "assert($(\"span\").hasClass(\"text-danger\"), 'Your span
element should have class \"text-danger\".')",
+ "assert(editor.match(/<\\/span>/g) && editor.match(//g).length === editor.match(/span element has a closing tag.')"
],
"challengeSeed": [
- "",
+ "",
"",
"",
- "Click here for cat photos.
", + "Click here for cat photos.
", "", - "Things cats love:
", + "Things cats love:
", "div
element.",
"Here's a diagram of how Bootstrap's 12-column grid layout works:",
- "h2
element within a single <div class='row'>
element. Nest your h2
text within a <div class='col-xs-8'>
and your image in a <div class='col-xs-4'>
so that they are on the same line.",
+ "Nest your first image and your h2
element within a single <div class=\"row\">
element. Nest your h2
text within a <div class=\"col-xs-8\">
and your image in a <div class=\"col-xs-4\">
so that they are on the same line.",
"Notice how the image is now just the right size to fit along the text?"
],
"tests": [
- "assert($('div.row:has(h2)').length > 0 && $('div.row:has(img)').length > 0, 'Your h2
element and topmost img
element should both be nested together within a div
element with the class \"row\".')",
- "assert($('div.col-xs-4:has(img)').length > 0, 'Nest your topmost img
element within a div
with the class \"col-xs-4\".')",
- "assert($('div.col-xs-8:has(h2)').length > 0, 'Nest your h2
element within a div
with the class \"col-xs-8\".')",
+ "assert($(\"div.row:has(h2)\").length > 0 && $(\"div.row:has(img)\").length > 0, 'Your h2
element and topmost img
element should both be nested together within a div
element with the class \"row\".')",
+ "assert($(\"div.col-xs-4:has(img)\").length > 0, 'Nest your topmost img
element within a div
with the class \"col-xs-4\".')",
+ "assert($(\"div.col-xs-8:has(h2)\").length > 0, 'Nest your h2
element within a div
with the class \"col-xs-8\".')",
"assert(editor.match(/<\\/div>/g) && editor.match(/Things cats love:
", + "Things cats love:
", "i
element with the classes \"fa\" and \"fa-thumbs-up\"."
],
"tests": [
- "assert($('i').hasClass('fa fa-thumbs-up'), 'Add an i
element with the classes \"fa\" and \"fa-thumbs-up\".')",
- "assert($('button').children('i').length > 0, 'Nest your i
element within your button
element.')",
+ "assert($(\"i\").hasClass(\"fa fa-thumbs-up\"), 'Add an i
element with the classes \"fa\" and \"fa-thumbs-up\".')",
+ "assert($(\"button\").children(\"i\").length > 0, 'Nest your i
element within your button
element.')",
"assert(editor.match(/<\\/i>/g), 'Make sure your i
element has a closing tag.')"
],
"challengeSeed": [
- "",
+ "",
"",
"",
- "Things cats love:
", + "Things cats love:
", "<i class=\"fa fa-trash\"></i>
within your delete button element.')",
- "assert($('i').hasClass('fa fa-info-circle'), 'You should add a <i class=\"fa fa-info-circle\"></i>
within your info button element.')",
+ "assert($(\"i\").hasClass(\"fa fa-trash\"), 'You should add a <i class=\"fa fa-trash\"></i>
within your delete button element.')",
+ "assert($(\"i\").hasClass(\"fa fa-info-circle\"), 'You should add a <i class=\"fa fa-info-circle\"></i>
within your info button element.')",
"assert(editor.match(/<\\/i>/g) && editor.match(/<\\/i/g).length > 2, 'Make sure each of your i
elements has a closing tag.')"
],
"challengeSeed": [
- "",
+ "",
"",
"",
- "Things cats love:
", + "Things cats love:
", "form
elements, too! This way, our radio buttons will be evenly spread out across the page, regardless of how wide the screen resolution is.",
- "Nest all of your radio buttons within a <div class='row'>
element. Then nest each of them within a <div class='col-xs-6'>
element."
+ "Nest all of your radio buttons within a <div class=\"row\">
element. Then nest each of them within a <div class=\"col-xs-6\">
element."
],
"tests": [
- "assert($('div.row:has(input[type=\\'radio\\'])').length > 0, 'Nest all of your radio buttons inside one div
with the class \"row\".')",
- "assert($('div.col-xs-6:has(input[type=\\'radio\\'])').length > 1, 'Nest each of your radio buttons inside its own div
with the class \"col-xs-6\".')",
+ "assert($(\"div.row:has(input[type=\\\"radio\\\"])\").length > 0, 'Nest all of your radio buttons inside one div
with the class \"row\".')",
+ "assert($(\"div.col-xs-6:has(input[type=\\\"radio\\\"])\").length > 1, 'Nest each of your radio buttons inside its own div
with the class \"col-xs-6\".')",
"assert(editor.match(/<\\/div>/g) && editor.match(/Things cats love:
", + "Things cats love:
", "form
elements, too! This way, our checkboxes will be evenly spread out across the page, regardless of how wide the screen resolution is.",
- "Nest all your checkboxes in a <div class='row'>
element. Then nest each of them in a <div class='col-xs-4'>
element."
+ "Nest all your checkboxes in a <div class=\"row\">
element. Then nest each of them in a <div class=\"col-xs-4\">
element."
],
"tests": [
- "assert($('div.row:has(input[type=\\'checkbox\\'])').length > 0, 'Nest all of your checkboxes inside one div
with the class \"row\".')",
- "assert($('div.col-xs-4:has(input[type=\\'checkbox\\'])').length > 2, 'Nest each of your checkboxes inside its own div
with the class \"col-xs-4\".')",
+ "assert($(\"div.row:has(input[type=\\\"checkbox\\\"])\").length > 0, 'Nest all of your checkboxes inside one div
with the class \"row\".')",
+ "assert($(\"div.col-xs-4:has(input[type=\\\"checkbox\\\"])\").length > 2, 'Nest each of your checkboxes inside its own div
with the class \"col-xs-4\".')",
"assert(editor.match(/<\\/div>/g) && editor.match(/Things cats love:
", + "Things cats love:
", "