Merge pull request #1748 from FreeCodeCamp/jquery

Improved challenges and normalized formating
This commit is contained in:
Berkeley Martinez
2015-08-13 15:52:02 -07:00
7 changed files with 1652 additions and 995 deletions

View File

@ -1,7 +1,7 @@
[ [
{ {
"id": 0, "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": [ "codeNames": [
"Juggernaut", "Juggernaut",
"Mrs. Wallace", "Mrs. Wallace",
@ -10,7 +10,7 @@
}, },
{ {
"id": 1, "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": [ "codeNames": [
"Oscar", "Oscar",
"Scrooge", "Scrooge",
@ -19,7 +19,7 @@
}, },
{ {
"id": 2, "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": [ "codeNames": [
"The Doctor", "The Doctor",
"Loki", "Loki",

View File

@ -38,7 +38,7 @@
"For now let's modify our <code>welcomeToBooleans</code>function so that it will return <code>true</code>instead of <code>false</code>when the run button is clicked" "For now let's modify our <code>welcomeToBooleans</code>function so that it will return <code>true</code>instead of <code>false</code>when the run button is clicked"
], ],
"tests": [ "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');" "assert(welcomeToBooleans() == true, 'The value returned by welcomeToBooleans() should be true');"
], ],
"challengeSeed": [ "challengeSeed": [
@ -65,7 +65,7 @@
"Look at the <code>ourName</code> example if you get stuck." "Look at the <code>ourName</code> example if you get stuck."
], ],
"tests": [ "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": [ "challengeSeed": [
"// var ourName = \"Free Code Camp\";", "// 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 use this to show you the value of your variable in your output box.",
"// We'll learn about functions soon.", "// 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", "type": "waypoint",
"challengeType": 1 "challengeType": 1
@ -89,8 +89,8 @@
"You can assign these variables to be equal to your first and last names respectively." "You can assign these variables to be equal to your first and last names respectively."
], ],
"tests": [ "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(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(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": [ "challengeSeed": [
"// ourName = \"Free Code Camp\";", "// ourName = \"Free Code Camp\";",
@ -101,7 +101,7 @@
"// You can ignore this.", "// You can ignore this.",
"// We use this to show you the value of your variable in your output box.", "// We use this to show you the value of your variable in your output box.",
"// We'll learn about functions soon.", "// 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", "type": "waypoint",
"challengeType": 1 "challengeType": 1
@ -115,7 +115,7 @@
"For example, if we created a variable <code>var firstName = \"Julie\"</code>, we could find out how long the string \"Julie\" is by using the <code>firstName.length</code> property." "For example, if we created a variable <code>var firstName = \"Julie\"</code>, we could find out how long the string \"Julie\" is by using the <code>firstName.length</code> property."
], ],
"tests": [ "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 <code>lastName</code> by using <code>.length</code> like this: <code>lastName.length</code>');" "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 <code>lastName</code> by using <code>.length</code> like this: <code>lastName.length</code>');"
], ],
"challengeSeed": [ "challengeSeed": [
@ -134,7 +134,7 @@
"// You can ignore this.", "// You can ignore this.",
"// We use this to show you the value of your variable in your output box.", "// We use this to show you the value of your variable in your output box.",
"// We'll learn about functions soon.", "// 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", "type": "waypoint",
"challengeType": 1 "challengeType": 1
@ -151,7 +151,7 @@
"Try looking at the <code>firstLetterOfFirstName</code> variable declaration if you get stuck." "Try looking at the <code>firstLetterOfFirstName</code> variable declaration if you get stuck."
], ],
"tests": [ "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": [ "challengeSeed": [
"var firstLetterOfLastName = \"\"", "var firstLetterOfLastName = \"\"",
@ -185,7 +185,7 @@
"Try looking at the <code>secondLetterOfFirstName</code> variable declaration if you get stuck." "Try looking at the <code>secondLetterOfFirstName</code> variable declaration if you get stuck."
], ],
"tests": [ "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": [ "challengeSeed": [
"var firstName = \"Madeline\";", "var firstName = \"Madeline\";",
@ -217,7 +217,7 @@
"Try looking at the <code>lastLetterOfLastName</code> variable declaration if you get stuck." "Try looking at the <code>lastLetterOfLastName</code> variable declaration if you get stuck."
], ],
"tests": [ "tests": [
"assert(lastLetterOfLastName == 'n', 'lastLetterOfLastName should be <code>n</code>');", "assert(lastLetterOfLastName == \"n\", 'lastLetterOfLastName should be <code>n</code>');",
"assert(editor.getValue().match(/\\.length/g), 'You have to use .length to get the last letter');" "assert(editor.getValue().match(/\\.length/g), 'You have to use .length to get the last letter');"
], ],
"challengeSeed": [ "challengeSeed": [
@ -247,7 +247,7 @@
"Try looking at the <code>lastLetterOfLastName</code> variable declaration if you get stuck." "Try looking at the <code>lastLetterOfLastName</code> variable declaration if you get stuck."
], ],
"tests": [ "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');" "assert(editor.getValue().match(/\\.length/g), 'You have to use .length to get the third last letter');"
], ],
"challengeSeed": [ "challengeSeed": [
@ -366,7 +366,7 @@
"Let's create a variable <code>myDecimal</code> and give it a decimal value." "Let's create a variable <code>myDecimal</code> and give it a decimal value."
], ],
"tests": [ "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": [ "challengeSeed": [
"//var ourDecimal = 5.7", "//var ourDecimal = 5.7",
@ -375,7 +375,7 @@
"", "",
"", "",
"", "",
"(function(){if(typeof(myDecimal) != 'undefined'){return(myDecimal);}})();" "(function(){if(typeof(myDecimal) != \"undefined\"){return(myDecimal);}})();"
], ],
"type": "waypoint", "type": "waypoint",
"challengeType": 1 "challengeType": 1
@ -414,12 +414,12 @@
"" ""
], ],
"tests": [ "tests": [
"assert(typeof(myArray) == 'object', 'myArray should be an array');", "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[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[1]) !== \"undefined\" && typeof(myArray[1]) == \"number\", 'The second item in myArray should be a number');"
], ],
"challengeSeed": [ "challengeSeed": [
"//var array = ['John', 23];", "//var array = [\"John\", 23];",
"", "",
"var myArray = [];", "var myArray = [];",
"", "",
@ -438,13 +438,13 @@
"Let's now go create a nested array called <code>myArray</code>" "Let's now go create a nested array called <code>myArray</code>"
], ],
"tests":[ "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":[ "challengeSeed":[
"var myArray = [];", "var myArray = [];",
"", "",
"", "",
"if(typeof(myArray) !== 'undefined'){(function(){return(myArray);})();}" "if(typeof(myArray) !== \"undefined\"){(function(){return(myArray);})();}"
], ],
"type": "waypoint", "type": "waypoint",
"challengeType": 1 "challengeType": 1
@ -464,7 +464,7 @@
"Create a var called <code>data</code> and set it to equal the first value of <code>myArray</code>" "Create a var called <code>data</code> and set it to equal the first value of <code>myArray</code>"
], ],
"tests":[ "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":[ "challengeSeed":[
"//var ourArray = [1,2,3]", "//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", "type": "waypoint",
"challengeType": 1 "challengeType": 1
@ -494,7 +494,7 @@
"" ""
], ],
"tests":[ "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');" "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":[ "challengeSeed":[
@ -506,7 +506,7 @@
"", "",
"", "",
"", "",
"if(typeof(myArray) != 'undefined'){(function(){return(myArray);})();}" "if(typeof(myArray) != \"undefined\"){(function(){return(myArray);})();}"
], ],
"type": "waypoint", "type": "waypoint",
"challengeType": 1 "challengeType": 1
@ -523,8 +523,8 @@
"Let's try <code>.pop()</code>now" "Let's try <code>.pop()</code>now"
], ],
"tests": [ "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] == \"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] == \"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": [ "challengeSeed": [
"//var numbers = [1,2,3];", "//var numbers = [1,2,3];",
@ -533,8 +533,8 @@
"//console.log(numbers); //Gives [1,2]", "//console.log(numbers); //Gives [1,2]",
"//console.log(removed); //Gives 3", "//console.log(removed); //Gives 3",
"", "",
"var myArray = ['John', 23, ['cat', 2]];", "var myArray = [\"John\", 23, [\"cat\", 2]];",
"var removed = myArray;//This should be ['cat', 2] and myArray should now be ['John', 23]", "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);" "(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z));})(myArray, removed);"
@ -548,15 +548,15 @@
"difficulty": "9.9818", "difficulty": "9.9818",
"description": [ "description": [
"Now that we've learned how to <code>pop</code>things from the end of the array, we need to learn how to <code>push</code>stuff back to the end", "Now that we've learned how to <code>pop</code>things from the end of the array, we need to learn how to <code>push</code>stuff back to the end",
"Let's take the code we had last time and <code>push</code>this value to the end: <code>['dog', 3] </code>" "Let's take the code we had last time and <code>push</code>this value to the end: <code>[\"dog\", 3] </code>"
], ],
"tests": [ "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": [ "challengeSeed": [
"var myArray = ['John', 23, ['cat', 2]];", "var myArray = [\"John\", 23, [\"cat\", 2]];",
"var removed = myArray.pop();", "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);" "(function(z){return('myArray = ' + JSON.stringify(z));})(myArray);"
@ -574,12 +574,12 @@
"Let's try <code>.shift()</code>now" "Let's try <code>.shift()</code>now"
], ],
"tests": [ "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[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 === \"John\" && typeof(removed) === \"string\"){return(true);}else{return(false);}})(removed), 'Removed should contain \"John\"');"
], ],
"challengeSeed": [ "challengeSeed": [
"var myArray = ['John', 23, ['dog', 3]];", "var myArray = [\"John\", 23, [\"dog\", 3]];",
"var removed = myArray;//This should be ['John'] and myArray should now be [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);" "(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z));})(myArray, removed);"
@ -593,15 +593,15 @@
"difficulty": "9.9818", "difficulty": "9.9818",
"description": [ "description": [
"Now that we've learned how to <code>shift</code>things from the start of the array, we need to learn how to <code>unshift</code>stuff back to the start", "Now that we've learned how to <code>shift</code>things from the start of the array, we need to learn how to <code>unshift</code>stuff back to the start",
"Let's take the code we had last time and <code>unshift</code>this value to the end: <code>'Paul' </code>" "Let's take the code we had last time and <code>unshift</code>this value to the end: <code>\"Paul\" </code>"
], ],
"tests": [ "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": [ "challengeSeed": [
"var myArray = ['John', 23, ['dog', 3]];", "var myArray = [\"John\", 23, [\"dog\", 3]];",
"var removed = myArray.shift();//This should be 'John' and myArray should now be [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", "//Add \"Paul\" to the start of myArray",
"", "",
"", "",
"(function(y, z){return('myArray = ' + JSON.stringify(y));})(myArray);" "(function(y, z){return('myArray = ' + JSON.stringify(y));})(myArray);"
@ -626,7 +626,7 @@
"Let's try creating and calling a function now called <code>myFunction</code>" "Let's try creating and calling a function now called <code>myFunction</code>"
], ],
"tests":[ "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":[ "challengeSeed":[
"var a = 4;", "var a = 4;",
@ -638,7 +638,7 @@
"", "",
"", "",
"//Don't modify this!", "//Don't modify this!",
"if(typeof(myFunction) != 'undefined'){", "if(typeof(myFunction) != \"undefined\"){",
"var f=myFunction(a,b);", "var f=myFunction(a,b);",
"(function(){return(f);})();", "(function(){return(f);})();",
"}" "}"
@ -666,17 +666,17 @@
"Let's try to make an Object that represents a dog called myDog!" "Let's try to make an Object that represents a dog called myDog!"
], ],
"tests":[ "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(\"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(\"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(\"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(\"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":[ "challengeSeed":[
"//var ourDog = {", "//var ourDog = {",
"// \"name\": \"Camper\"", "// \"name\": \"Camper\"",
"// \"legs\": 4", "// \"legs\": 4",
"// \"tails\": 1", "// \"tails\": 1",
"// \"friends\": ['everything!']", "// \"friends\": [\"everything!\"]",
"//};", "//};",
"", "",
"/* add the name(string), legs(number), tails(number) and friends(array) properties to myDog.", "/* add the name(string), legs(number), tails(number) and friends(array) properties to myDog.",
@ -719,7 +719,7 @@
"//Re-create myDog", "//Re-create myDog",
"", "",
"var myDog = {", "var myDog = {",
" \"name\": 'Camper',", " \"name\": \"Camper\",",
" \"legs\": 4,", " \"legs\": 4,",
" \"tails\": 1,", " \"tails\": 1,",
" \"friends\": []", " \"friends\": []",
@ -835,7 +835,7 @@
"Let's have a go of <code>Math.random()</code> now be getting <code>myFunction</code> to return a random number" "Let's have a go of <code>Math.random()</code> now be getting <code>myFunction</code> to return a random number"
], ],
"tests":[ "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((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');" "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" "Let's give this technique a go now"
], ],
"tests":[ "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(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(!(''+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');" "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 <code>heads</code> if the flip var is zero and to return <code>tails</code> if it's not" "Create an if else statement to return <code>heads</code> if the flip var is zero and to return <code>tails</code> if it's not"
], ],
"tests":[ "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(/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');" "assert(editor.getValue().match(/else/g).length >= 2, 'You should have created a new else statement');"
], ],
@ -1077,9 +1077,9 @@
"<code>Math.floor(Math.random() * (5 - 1 + 1)) + 1; </code>" "<code>Math.floor(Math.random() * (5 - 1 + 1)) + 1; </code>"
], ],
"tests":[ "tests":[
"assert(typeof(runSlots($('.slot'))[0]) == 'number', 'slotOne 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\"))[1]) == \"number\", 'slotTwo should be a random number');",
"assert(typeof(runSlots($('.slot'))[2]) == 'number', 'slotThree 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');" "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":[ "challengeSeed":[
@ -1089,7 +1089,7 @@
" var slotTwo;", " var slotTwo;",
" var slotThree;", " 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*/", " /*Don't modify above here*/",
" ", " ",
@ -1097,48 +1097,48 @@
" ", " ",
" /*Don't modify below here*/", " /*Don't modify below here*/",
" ", " ",
" $('.logger').html('');", " $(\".logger\").html(\"\");",
" $('.logger').html('Not A Win')", " $(\".logger\").html(\"Not A Win\")",
" ", " ",
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){", " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
" $('.logger').html(slotOne + ' ' + slotTwo + ' ' + slotThree);", " $(\".logger\").html(slotOne + \" \" + slotTwo + \" \" + slotThree);",
" }", " }",
" return([slotOne, slotTwo, slotThree]);", " return([slotOne, slotTwo, slotThree]);",
" }", " }",
"", "",
" $(document).ready(function(){", " $(document).ready(function(){",
" $('.go').click(function(){", " $(\".go\").click(function(){",
" runSlots();", " runSlots();",
" });", " });",
" });", " });",
"fcces", "fcces",
" ", " ",
"<div>", "<div>",
" <div class = 'container inset'>", " <div class = \"container inset\">",
" <div class = 'header inset'>", " <div class = \"header inset\">",
" <img src='https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz' alt='learn to code javascript at Free Code Camp logo' class='img-responsive nav-logo'>", " <img src=\"https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz\" alt=\"learn to code javascript at Free Code Camp logo\" class=\"img-responsive nav-logo\">",
" <h2>FCC Slot Machine</h2>", " <h2>FCC Slot Machine</h2>",
" </div>", " </div>",
" <div class = 'slots inset'>", " <div class = \"slots inset\">",
" <div class = 'slot inset'>", " <div class = \"slot inset\">",
" ", " ",
" </div>", " </div>",
" <div class = 'slot inset'>", " <div class = \"slot inset\">",
" ", " ",
" </div>", " </div>",
" <div class = 'slot inset'>", " <div class = \"slot inset\">",
" ", " ",
" </div>", " </div>",
" </div>", " </div>",
" <br/>", " <br/>",
" <div class = 'outset'>", " <div class = \"outset\">",
" <button class = 'go inset'>", " <button class = \"go inset\">",
" Go", " Go",
" </button>", " </button>",
" </div>", " </div>",
" <br/>", " <br/>",
" <div class = 'foot inset'>", " <div class = \"foot inset\">",
" <span class = 'logger'></span>", " <span class = \"logger\"></span>",
" </div>", " </div>",
" </div>", " </div>",
"</div>", "</div>",
@ -1242,62 +1242,62 @@
" var slotTwo;", " var slotTwo;",
" var slotThree;", " 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\"];",
" ", " ",
" slotOne = Math.floor(Math.random() * (5 - 1 + 1)) + 1;", " slotOne = Math.floor(Math.random() * (5 - 1 + 1)) + 1;",
" slotTwo = 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;", " slotThree = Math.floor(Math.random() * (5 - 1 + 1)) + 1;",
" ", " ",
" $('.logger').html('');", " $(\".logger\").html(\"\");",
" $('.logger').html('Not A Win')", " $(\".logger\").html(\"Not A Win\")",
" ", " ",
" /*Don't modify above here*/", " /*Don\"t modify above here*/",
" ", " ",
" ", " ",
" ", " ",
" /*Don't modify below here*/", " /*Don\"t modify below here*/",
" ", " ",
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){", " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
" $('.logger').html(slotOne);", " $(\".logger\").html(slotOne);",
" $('.logger').append(' ' + slotTwo);", " $(\".logger\").append(\" \" + slotTwo);",
" $('.logger').append(' ' + slotThree);", " $(\".logger\").append(\" \" + slotThree);",
" }", " }",
" return([slotOne, slotTwo, slotThree]);", " return([slotOne, slotTwo, slotThree]);",
" }", " }",
"", "",
" $(document).ready(function(){", " $(document).ready(function(){",
" $('.go').click(function(){", " $(\".go\").click(function(){",
" runSlots();", " runSlots();",
" });", " });",
" });", " });",
"fcces", "fcces",
" ", " ",
"<div>", "<div>",
" <div class = 'container inset'>", " <div class = \"container inset\">",
" <div class = 'header inset'>", " <div class = \"header inset\">",
" <img src='https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz' alt='learn to code javascript at Free Code Camp logo' class='img-responsive nav-logo'>", " <img src=\"https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz\" alt=\"learn to code javascript at Free Code Camp logo\" class=\"img-responsive nav-logo\">",
" <h2>FCC Slot Machine</h2>", " <h2>FCC Slot Machine</h2>",
" </div>", " </div>",
" <div class = 'slots inset'>", " <div class = \"slots inset\">",
" <div class = 'slot inset'>", " <div class = \"slot inset\">",
" ", " ",
" </div>", " </div>",
" <div class = 'slot inset'>", " <div class = \"slot inset\">",
" ", " ",
" </div>", " </div>",
" <div class = 'slot inset'>", " <div class = \"slot inset\">",
" ", " ",
" </div>", " </div>",
" </div>", " </div>",
" <br/>", " <br/>",
" <div class = 'outset'>", " <div class = \"outset\">",
" <button class = 'go inset'>", " <button class = \"go inset\">",
" Go", " Go",
" </button>", " </button>",
" </div>", " </div>",
" <br/>", " <br/>",
" <div class = 'foot inset'>", " <div class = \"foot inset\">",
" <span class = 'logger'></span>", " <span class = \"logger\"></span>",
" </div>", " </div>",
" </div>", " </div>",
"</div>", "</div>",
@ -1384,15 +1384,15 @@
"difficulty":"9.990", "difficulty":"9.990",
"description":[ "description":[
"Now we can detect a win let's get the slot machine to look like it works", "Now we can detect a win let's get the slot machine to look like it works",
"We're going to use the jQuery selector <code>$('.slot')</code> to select all of the slots", "We're going to use the jQuery selector <code>$(\".slot\")</code> to select all of the slots",
"Once they are all selected we can use bracket notation to access each individual one like this", "Once they are all selected we can use bracket notation to access each individual one like this",
"<code>$($('.slot')[0]).html('')</code>", "<code>$($(\".slot\")[0]).html(\"\")</code>",
"This will grab the the first slot so that we can add the numbers we generate to them", "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" "Use the above selector to display each number in the corresponding slot"
], ],
"tests":[ "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(){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&#44; slotTwo and slotThree respectively');" "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&#44; slotTwo and slotThree respectively');"
], ],
"challengeSeed":[ "challengeSeed":[
"fccss", "fccss",
@ -1402,14 +1402,14 @@
" var slotThree;", " var slotThree;",
" ", " ",
" //Placeholder", " //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;", " slotOne = Math.floor(Math.random() * (5 - 1 + 1)) + 1;",
" slotTwo = 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;", " slotThree = Math.floor(Math.random() * (5 - 1 + 1)) + 1;",
" ", " ",
" $('.logger').html('');", " $(\".logger\").html(\"\");",
" $('.logger').html('Not A Win')", " $(\".logger\").html(\"Not A Win\")",
" ", " ",
" /*Don't modify above here*/", " /*Don't modify above here*/",
" ", " ",
@ -1422,47 +1422,47 @@
" }", " }",
" ", " ",
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){", " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
" $('.logger').html(slotOne);", " $(\".logger\").html(slotOne);",
" $('.logger').append(' ' + slotTwo);", " $(\".logger\").append(\" \" + slotTwo);",
" $('.logger').append(' ' + slotThree);", " $(\".logger\").append(\" \" + slotThree);",
" }", " }",
" ", " ",
" return([slotOne, slotTwo, slotThree]);", " return([slotOne, slotTwo, slotThree]);",
" }", " }",
"", "",
" $(document).ready(function(){", " $(document).ready(function(){",
" $('.go').click(function(){", " $(\".go\").click(function(){",
" runSlots();", " runSlots();",
" });", " });",
" });", " });",
"fcces", "fcces",
" ", " ",
"<div>", "<div>",
" <div class = 'container inset'>", " <div class = \"container inset\">",
" <div class = 'header inset'>", " <div class = \"header inset\">",
" <img src='https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz' alt='learn to code javascript at Free Code Camp logo' class='img-responsive nav-logo'>", " <img src=\"https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz\" alt=\"learn to code javascript at Free Code Camp logo\" class=\"img-responsive nav-logo\">",
" <h2>FCC Slot Machine</h2>", " <h2>FCC Slot Machine</h2>",
" </div>", " </div>",
" <div class = 'slots inset'>", " <div class = \"slots inset\">",
" <div class = 'slot inset'>", " <div class = \"slot inset\">",
" ", " ",
" </div>", " </div>",
" <div class = 'slot inset'>", " <div class = \"slot inset\">",
" ", " ",
" </div>", " </div>",
" <div class = 'slot inset'>", " <div class = \"slot inset\">",
" ", " ",
" </div>", " </div>",
" </div>", " </div>",
" <br/>", " <br/>",
" <div class = 'outset'>", " <div class = \"outset\">",
" <button class = 'go inset'>", " <button class = \"go inset\">",
" Go", " Go",
" </button>", " </button>",
" </div>", " </div>",
" <br/>", " <br/>",
" <div class = 'foot inset'>", " <div class = \"foot inset\">",
" <span class = 'logger'></span>", " <span class = \"logger\"></span>",
" </div>", " </div>",
" </div>", " </div>",
"</div>", "</div>",

View File

@ -9,8 +9,6 @@
"challengeSeed": ["125658022"], "challengeSeed": ["125658022"],
"description": [ "description": [
"Now you're ready to start our Zipline challenges. These front-end development challenges will give you many opportunities to apply the HTML, CSS, jQuery and JavaScript you've learned to build static (database-less) applications.", "Now you're ready to start our Zipline challenges. These front-end development challenges will give you many opportunities to apply the HTML, CSS, jQuery and JavaScript you've learned to build static (database-less) applications.",
"For many of these challenges, you will be using JSON data from external API endpoints, such as Twitch.tv and Twitter. Note that you don't need to have a database to use these data.",
"The easiest way to manipulate these data is with <a href='http://api.jquery.com/jquery.getjson/' target='_blank'>jQuery $.getJSON()</a>.",
"Whatever you do, don't get discouraged! Remember to use <a href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck' target='_blank'>Read-Search-Ask</a> if you get stuck.", "Whatever you do, don't get discouraged! Remember to use <a href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck' target='_blank'>Read-Search-Ask</a> if you get stuck.",
"We'll build these challenges using CodePen, a popular tool for creating, sharing, and discovering static web applications.", "We'll build these challenges using CodePen, a popular tool for creating, sharing, and discovering static web applications.",
"Go to <a href='http://codepen.io' target='_blank'>http://codepen.io</a> and create an account.", "Go to <a href='http://codepen.io' target='_blank'>http://codepen.io</a> and create an account.",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
{
"name": "JSON APIs and Ajax - Coming Soon",
"order": 0.007,
"challenges": [
]
}

View File

@ -0,0 +1,564 @@
{
"name": "JSON APIs and Ajax",
"order": 0.007,
"challenges": [
{
"id": "bad87fed1348bd9aeca08826",
"title": "Trigger on click Events with jQuery",
"difficulty": 3.19,
"description": [
"<code>.on('click', function() {</code>",
"",
"});</code>"
],
"tests": [
],
"challengeSeed": [
"fccss",
" $(document).ready(function() {</code>",
"",
"<code> });</code>",
"fcces",
"",
"<!-- You shouldn't need to modify code below this line -->",
"",
"<div class=\"container-fluid\">",
" <form action=\"/submit-cat-photo\">",
" <label><input type=\"radio\" name=\"indoor-outdoor\"> Indoor</label>",
" <label><input type=\"radio\" name=\"indoor-outdoor\"> Outdoor</label>",
" <input type=\"text\" placeholder=\"cat photo URL\" required>",
" <button type=\"submit\">Submit</button>",
" </form>",
"</div>"
],
"challengeType": 0,
"type": "waypoint"
},
{
"id": "bad87fee1348bd9aeca08826",
"title": "Learn how JSON works",
"difficulty": 3.19,
"description": [
"JSON stands for \"JavaScript Object Notation\". It\"s how you create objects in JavaScript.",
"JSON is a series of \"key-value pairs\". Everything on the left of the colon (<code>:</code>) is the \"key\" you use to unlock the \"value\" on the right of the colon."
],
"tests": [
],
"challengeSeed": [
"fccss",
"catPhotoJSON = [",
" {",
" \"id\": 0,",
" \"imageLink\": \"https://s3.amazonaws.com/freecodecamp/funny-cat.jpg\",",
" \"codeNames\": [",
" \"Juggernaut\",",
" \"Mrs. Wallace\",",
" \"Buttercup\"",
" ]",
" },",
" {",
" \"id\": 1,",
" \"imageLink\": \"https://s3.amazonaws.com/freecodecamp/grumpy-cat.jpg\",",
" \"codeNames\": [",
" \"Oscar\",",
" \"Scrooge\",",
" \"Tyrion\"",
" ]",
" },",
" {",
" \"id\": 2,",
" \"imageLink\": \"https://s3.amazonaws.com/freecodecamp/mischievous-cat.jpg\",",
" \"codeNames\": [",
" \"The Doctor\",",
" \"Loki\",",
" \"Joker\"",
" ]",
" }",
" ]",
"",
"<code> });</code>",
"fcces",
"",
"<!-- You shouldn't need to modify code below this line -->",
"",
"<div class=\"container-fluid\">",
" <div class=\"jumbotron\" id=\"output\">",
" </div>",
"</div>"
],
"challengeType": 0,
"type": "waypoint"
},
{
"id": "bad84fee1348bd9aecc58826",
"title": "Read Data from an Element Using jQuery",
"dashedName": "waypoint-read-data-from-an-element-using-jquery",
"difficulty": 3.17,
"description": [
"Let's make everything roll with <code>rollOut</code>."
],
"tests": [
],
"challengeSeed": [
"fccss",
" $(document).ready(function() {",
" $(\"button\").on(\"click\", function() {",
"",
" });",
" });",
"fcces",
"",
"<!-- You shouldn't need to modify code below this line -->",
"",
"<div class=\"container-fluid\">",
" <div class=\"row\">",
" <div class=\"col-xs-2\">",
" <input type=\"checkbox\" id=\"check-me\">",
" </div>",
" <div class=\"col-xs-10\">",
" <p>#check-me</p>",
" </div>",
" <button class=\"btn btn-block btn-primary\">#click-me</button>",
" <span>Is the checkbox checked?</span>",
" <span id=\"checked-state\"></span>",
"</div>"
],
"challengeType": 0,
"type": "waypoint"
},
{
"id": "bad84fee1348bd9aecc48826",
"title": "Read Data from an Element Using jQuery",
"dashedName": "waypoint-read-data-from-an-element-using-jquery",
"difficulty": 3.17,
"description": [
"Let's make everything roll with <code>rollOut</code>."
],
"tests": [
],
"challengeSeed": [
"fccss",
" $(document).ready(function() {",
" $(\"button\").on(\"click\", function() {",
" $(\"#click-me\").addClass(\"animated shake\");",
" });",
" });",
"fcces",
"",
"<!-- You shouldn't need to modify code below this line -->",
"",
"<div class=\"container-fluid\">",
" <div class=\"row\">",
" <div class=\"col-xs-2\">",
" <input type=\"checkbox\" id=\"check-me\">",
" </div>",
" <div class=\"col-xs-10\">",
" <p>#check-me</p>",
" </div>",
" <button class=\"btn btn-block btn-primary\">#click-me</button>",
" <span>Is the checkbox checked?</span>",
" <span id=\"checked-state\"></span>",
"</div>"
],
"challengeType": 0,
"type": "waypoint"
},
{
"id": "bad84fee1348bd9aecc38826",
"title": "Read Data from an Element Using jQuery",
"dashedName": "waypoint-read-data-from-an-element-using-jquery",
"difficulty": 3.17,
"description": [
"Let's make everything roll with <code>rollOut</code>."
],
"tests": [
],
"challengeSeed": [
"fccss",
" $(document).ready(function() {",
" $(\"button\").on(\"click\", function() {",
" $(\"#click-me\").addClass(\"animated shake\");",
" $(\"#checked-state\").text(\"happy text\");",
" });",
" });",
"fcces",
"",
"<!-- You shouldn't need to modify code below this line -->",
"",
"<div class=\"container-fluid\">",
" <div class=\"row\">",
" <div class=\"col-xs-2\">",
" <input type=\"checkbox\" id=\"check-me\">",
" </div>",
" <div class=\"col-xs-10\">",
" <p>#check-me</p>",
" </div>",
" <button class=\"btn btn-block btn-primary\">#click-me</button>",
" <span>Is the checkbox checked?</span>",
" <span id=\"checked-state\"></span>",
"</div>"
],
"challengeType": 0,
"type": "waypoint"
},
{
"id": "bad84fee1348bd9aecc28826",
"title": "Read Data from an Element Using jQuery",
"dashedName": "waypoint-read-data-from-an-element-using-jquery",
"difficulty": 3.17,
"description": [
"Let's make everything roll with <code>rollOut</code>."
],
"tests": [
],
"challengeSeed": [
"fccss",
" $(document).ready(function() {",
" $(\"button\").on(\"click\", function() {",
" $(\"#click-me\").addClass(\"animated shake\");",
" $(\"#checked-state\").text($(\"#check-me\").prop(\"checked\"));",
" });",
" });",
"fcces",
"",
"<!-- You shouldn't need to modify code below this line -->",
"",
"<div class=\"container-fluid\">",
" <div class=\"row\">",
" <div class=\"col-xs-2\">",
" <input type=\"checkbox\" id=\"check-me\">",
" </div>",
" <div class=\"col-xs-10\">",
" <p>#check-me</p>",
" </div>",
" <button class=\"btn btn-block btn-primary\">#click-me</button>",
" <span>Is the checkbox checked?</span>",
" <span id=\"checked-state\"></span>",
"</div>"
],
"challengeType": 0,
"type": "waypoint"
},
{
"id": "bad84fee1348bd9aecc18826",
"title": "Read Data from an Element Using jQuery",
"dashedName": "waypoint-read-data-from-an-element-using-jquery",
"difficulty": 3.17,
"description": [
],
"tests": [
],
"challengeSeed": [
"fccss",
" $(document).ready(function() {",
" $(\"button\").on(\"click\", function() {",
" $(\"#click-me\").addClass(\"animated shake\");",
" $(\"#checked-state\").text($(\"#check-me\").prop(\"checked\"));",
" });",
" });",
"fcces",
"",
"<!-- You shouldn't need to modify code below this line -->",
"",
"<div class=\"container-fluid\">",
" <div class=\"row\">",
" <div class=\"col-xs-2\">",
" <input type=\"checkbox\" id=\"check-me\">",
" </div>",
" <div class=\"col-xs-10\">",
" <p>#check-me</p>",
" </div>",
" <button class=\"btn btn-block btn-primary\">#click-me</button>",
" <span>Is the checkbox checked?</span>",
" <span id=\"checked-state\"></span>",
"</div>"
],
"challengeType": 0,
"type": "waypoint"
},
{
"id": "bad87fee1348bd9aecc08826",
"title": "Trigger onHover Events with jQuery",
"dashedName": "waypoint-trigger-onhover-events-with-jquery",
"difficulty": 3.18,
"description": [
],
"tests": [
],
"challengeSeed": [
],
"challengeType": 0,
"type": "waypoint"
},
{
"id": "bad87fee1348bd9aebc08726",
"title": "Learn how JSON Works",
"description": [
"JSON stands for \"JavaScript Object Notation\". It\"s how you create objects in JavaScript.",
"JSON is a series of \"key-value pairs\". Everything on the left of the colon (<code>:</code>) is the \"key\" you use to unlock the \"value\" on the right of the colon."
],
"tests": [
],
"challengeSeed": [
"[",
" {",
" \"id\": 0,",
" \"imageLink\": \"http://rs611.pbsrc.com/albums/tt194/allypopper423/Funny-Cat-Green-Avacado.jpg~c200\",",
" \"codeNames\": [",
" \"Juggernaut\",",
" \"Mrs. Wallace\",",
" \"Buttercup\"",
" ]",
" },",
" {",
" \"id\": 1,",
" \"imageLink\": \"http://cdn.grumpycats.com/wp-content/uploads/2012/09/GC-Gravatar-copy.png\",",
" \"codeNames\": [",
" \"Oscar\",",
" \"Scrooge\",",
" \"Tyrion\"",
" ]",
" },",
" {",
" \"id\": 2,",
" \"imageLink\": \"http://www.kittenspet.com/wp-content/uploads/2012/08/cat_with_funny_face_3-200x200.jpg\",",
" \"codeNames\": [",
" \"The Doctor\",",
" \"Loki\",",
" \"Joker\"",
" ]",
" }",
"]"
],
"challengeType": 0,
"type": "waypoint"
},
{
"id": "bad87fee1348bd9aebc08826",
"title": "Get Data from an URL Using jQuery",
"dashedName": "waypoint-get-data-from-a-url-using-jquery",
"difficulty": 3.21,
"description": [
],
"tests": [
],
"challengeSeed": [
"fccss",
"",
" $(document).ready(function() {",
"",
" $(\"#cat-button\").on(\"click\", function() {",
" $.getJSON(\"/json/cats.json\", function( json ) {",
"",
" });",
" });",
"",
" });",
"fcces",
"<div class=\"container-fluid\">",
" <button id=\"cat-button\" class=\"btn btn-primary btn-block btn-lg\">#cat-button</button>",
" <div class=\"jumbotron\" id=\"output\">",
" </div>",
"</div>"
],
"challengeType": 0,
"type": "waypoint"
},
{
"id": "bad87fee1348bd9ae9c08826",
"title": "Loop through JSON Data Using jQuery",
"dashedName": "waypoint-loop-through-json-data-using-jquery",
"difficulty": 3.22,
"description": [
],
"tests": [
],
"challengeSeed": [
"fccss",
"",
" $(document).ready(function() {",
"",
" $(\"#cat-button\").on(\"click\", function() {",
" $.getJSON(\"/json/cats.json\", function( json ) {",
"",
" });",
" });",
"",
" });",
"fcces",
"<div class=\"container-fluid\">",
" <button id=\"cat-button\" class=\"btn btn-primary btn-block btn-lg\">#cat-button</button>",
" <div class=\"jumbotron\" id=\"output\">",
" </div>",
"</div>"
],
"challengeType": 0,
"type": "waypoint"
},
{
"id": "bad88fee1348bd9ae8c08726",
"title": "Wire AJAX Call into a jQuery Click Event",
"dashedName": "waypoint-wire-ajax-call-into-a-jquery-click-event",
"difficulty": 3.24,
"description": [
"<img src=\"https://www.evernote.com/l/AjmAQ5BxGrFGRrWl_j2eSpGZMfrunfse89gB/image.png\">"
],
"tests": [
],
"challengeSeed": [
"fccss",
" var random = function() { return Math.floor(Math.random() * 3) }",
" $(document).ready(function() {",
"",
" $(\"#cat-button\").on(\"click\", function() {",
" $.getJSON(\"/json/cats.json\", function( json ) {",
"",
" });",
" });",
"",
" });",
"fcces",
"<div class=\"container-fluid\">",
" <button id=\"cat-button\" class=\"btn btn-primary btn-block btn-lg\">#cat-button</button>",
" <div class=\"jumbotron\" id=\"output\">",
" </div>",
"</div>"
],
"challengeType": 0,
"type": "waypoint"
},
{
"id": "bad88fee1348bd9ae8c08626",
"title": "Wire AJAX Call into a jQuery Click Event",
"dashedName": "waypoint-wire-ajax-call-into-a-jquery-click-event",
"difficulty": 3.24,
"description": [
"<img src=\"https://www.evernote.com/l/AjmAQ5BxGrFGRrWl_j2eSpGZMfrunfse89gB/image.png\">"
],
"tests": [
],
"challengeSeed": [
"fccss",
" var random = function() { return Math.floor(Math.random() * 3) }",
" $(document).ready(function() {",
"",
" $(\"#cat-button\").on(\"click\", function() {",
" $.getJSON(\"/json/cats.json\", function( json ) {",
" var kitten = json[random()];",
" });",
" });",
"",
" });",
"fcces",
"<div class=\"container-fluid\">",
" <button id=\"cat-button\" class=\"btn btn-primary btn-block btn-lg\">#cat-button</button>",
" <div class=\"jumbotron\" id=\"output\">",
" </div>",
"</div>"
],
"challengeType": 0,
"type": "waypoint"
},
{
"id": "bad88fee1348bd9ae8c08526",
"title": "Wire AJAX Call into a jQuery Click Event",
"dashedName": "waypoint-wire-ajax-call-into-a-jquery-click-event",
"difficulty": 3.24,
"description": [
"<img src=\"https://www.evernote.com/l/AjmAQ5BxGrFGRrWl_j2eSpGZMfrunfse89gB/image.png\">"
],
"tests": [
],
"challengeSeed": [
"fccss",
" var random = function() { return Math.floor(Math.random() * 3) }",
" $(document).ready(function() {",
"",
" $(\"#cat-button\").on(\"click\", function() {",
" $.getJSON(\"/json/cats.json\", function( json ) {",
" var kitten = json[random()];",
" $(\"<img src=\"\" + kitten.imageLink + \"\">\").appendTo(\"#output\");",
" });",
" });",
"",
" });",
"<div class=\"container-fluid\">",
" <button id=\"cat-button\" class=\"btn btn-primary btn-block btn-lg\">#cat-button</button>",
" <div class=\"jumbotron\" id=\"output\">",
" </div>",
"</div>"
],
"challengeType": 0,
"type": "waypoint"
},
{
"id": "bad88fee1348bd9ae8c08426",
"title": "Wire AJAX Call into a jQuery Click Event",
"dashedName": "waypoint-wire-ajax-call-into-a-jquery-click-event",
"difficulty": 3.24,
"description": [
"<img src=\"https://www.evernote.com/l/AjmAQ5BxGrFGRrWl_j2eSpGZMfrunfse89gB/image.png\">"
],
"tests": [
],
"challengeSeed": [
"fccss",
" var random = function() { return Math.floor(Math.random() * 3) }",
" $(document).ready(function() {",
"",
" $(\"#cat-button\").on(\"click\", function() {",
" $.getJSON(\"/json/cats.json\", function( json ) {",
" var kitten = json[random()];",
" $(\"<img src=\"\" + kitten.imageLink + \"\">\").appendTo(\"#output\");",
" $(\"<h3>Code name: \" + kitten.codeNames[random()] + \"</h3>\").appendTo(\"#output\");",
" });",
" });",
"",
" });",
"fcces",
"<div class=\"container-fluid\">",
" <button id=\"cat-button\" class=\"btn btn-primary btn-block btn-lg\">#cat-button</button>",
" <div class=\"jumbotron\" id=\"output\">",
" </div>",
"</div>"
],
"challengeType": 0,
"type": "waypoint"
}
]
}