diff --git a/challenges/automated-testing-and-debugging.json b/challenges/automated-testing-and-debugging.json
index 4a3d67e162..a62368eee0 100644
--- a/challenges/automated-testing-and-debugging.json
+++ b/challenges/automated-testing-and-debugging.json
@@ -1,22 +1,23 @@
{
- "name": "Automated Testing and Debugging - Coming Soon",
+ "name": "Automated Testing and Debugging",
"order": 0.012,
"challenges": [
{
"id":"cf1111c1c16feddfaeb6bdef",
- "title":"Using the Javascript console",
+ "title":"Use the Javascript Console",
"difficulty":0,
"description":[
- "",
- "The browser console is the best and easiest tool for debugging your scripts",
- "It can normally be access by pressing f12 in most browsers or right click > inspect element > console",
- "Let's print to this console using the console.log method",
+ "Both Chrome and Firefox have excellent JavaScript consoles, also known as DevTools, for debugging your JavaScript.",
+ "You can find Developer tools
in your Chrome's menu or Web Console
in FireFox's menu. If you're using a different browser, or a mobile phone, we strongly recommend switching to desktop Firefox or Chrome.",
+ "Let's print to this console using the console.log
method.",
"console.log('Hello world!')
"
],
"tests":[
- "assert(editor.getValue().match(/console\\.log\\(/gi), 'You should use the console.log method to ');"
+ "assert(editor.getValue().match(/console\\.log\\(/gi), 'You should use the console.log method to log \"Hello world!\" to your JavaScript console.');"
],
"challengeSeed":[
+ "",
+ "",
""
],
"challengeType":1
@@ -26,22 +27,23 @@
"title":"Using typeof",
"difficulty":0,
"description":[
- "",
- "typeof is a useful method that we can use to check the type of a variable",
- "One thing to be careful of is that an array has the type objects",
- "Try using each of these to see the types they have",
- "console.log(typeof(\"\"));",
- "console.log(typeof(0));",
- "console.log(typeof([]));",
- "console.log(typeof({}));
"
+ "typeof
is a useful method that we can use to check the type of a variable.",
+ "One thing to be careful of is that an array has the type objects.",
+ "Try using each of these to see the types they have.",
+ "console.log(typeof(\"\"));
",
+ "console.log(typeof(0));
",
+ "console.log(typeof([]));
",
+ "console.log(typeof({}));
"
],
"tests":[
- "assert(editor.getValue().match(/console\\.log\\(typeof\\(\"\"\\)\\);/gi), 'You should console.log the typeof a string');",
- "assert(editor.getValue().match(/console\\.log\\(typeof\\(0\\)\\);/gi), 'You should console.log the typeof a number');",
- "assert(editor.getValue().match(/console\\.log\\(typeof\\(\\[\\]\\)\\);/gi), 'You should console.log the typeof a array');",
- "assert(editor.getValue().match(/console\\.log\\(typeof\\(\\{\\}\\)\\);/gi), 'You should console.log the typeof a object');"
+ "assert(editor.getValue().match(/console\\.log\\(typeof\\(\"\"\\)\\);/gi), 'You should console.log
the typeof
a string.');",
+ "assert(editor.getValue().match(/console\\.log\\(typeof\\(0\\)\\);/gi), 'You should console.log
the typeof
a number.');",
+ "assert(editor.getValue().match(/console\\.log\\(typeof\\(\\[\\]\\)\\);/gi), 'You should console.log
the typeof
an array.');",
+ "assert(editor.getValue().match(/console\\.log\\(typeof\\(\\{\\}\\)\\);/gi), 'You should console.log
the typeof
a object.');"
],
"challengeSeed":[
+ "",
+ "",
""
],
"challengeType":1
diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json
index b219af3adc..485e32772f 100644
--- a/challenges/basic-javascript.json
+++ b/challenges/basic-javascript.json
@@ -45,7 +45,7 @@
"",
" return false;",
"",
- "// don't change code below here",
+ "// Only change code above this line.",
"}",
"",
"welcomeToBooleans();"
@@ -71,7 +71,7 @@
"// var ourName = \"Free Code Camp\";",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"",
@@ -98,7 +98,7 @@
"// var lastName = \"Turing\";",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"if(typeof(myFirstName) !== \"undefined\" && typeof(myLastName) !== \"undefined\"){(function(){return(myFirstName + ', ' + myLastName);})();}"
@@ -128,11 +128,13 @@
"",
"var lastName = \"Lovelace\";",
"",
+ "// don't change code above here",
+ "",
"lastNameLength = lastName;",
"",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"if(typeof(lastNameLength) !== \"undefined\"){(function(){return(lastNameLength);})();}"
@@ -167,7 +169,7 @@
"firstLetterOfLastName = lastName;",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"(function(v){return(v);})(firstLetterOfLastName);"
@@ -198,7 +200,7 @@
"var thirdLetterOfLastName = lastName;",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"(function(v){return(v);})(thirdLetterOfLastName);"
@@ -230,7 +232,7 @@
"var lastLetterOfLastName = lastName;",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"(function(v){return(v);})(lastLetterOfLastName);"
@@ -262,7 +264,7 @@
"var secondToLastLetterOfLastName = lastName;",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"(function(v){return(v);})(secondToLastLetterOfLastName);"
@@ -285,7 +287,7 @@
"challengeSeed": [
"var sum = 10 + 0; //make this equal to 20 by changing the 0 into the appropriate number.",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"(function(z){return('sum='+z);})(sum);"
@@ -308,7 +310,7 @@
"challengeSeed": [
"var difference = 45 - 0; //make this equal to 12 by changing the 0 into the appropriate number.",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"(function(z){return('difference='+z);})(difference);"
@@ -331,7 +333,7 @@
"challengeSeed": [
"var product = 8 * 0; //make this equal to 80 by changing the 0 into the appropriate number.",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"(function(z){return('product='+z);})(product)"
@@ -354,7 +356,7 @@
"challengeSeed": [
"var quotient = 66 / 0; //make this equal to 2 by changing the 0 into the appropriate number.",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"(function(z){return('quotient='+z);})(quotient);"
@@ -379,7 +381,7 @@
"",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"(function(){if(typeof(myDecimal) !== \"undefined\"){return(myDecimal);}})();"
@@ -403,8 +405,7 @@
"var product = 2.0 * 0.0; // equals 5.0",
"",
"",
- "",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"(function(y){return('product='+y);})(product);"
@@ -431,9 +432,10 @@
"//var array = [\"John\", 23];",
"",
"var myArray = [];",
+ "// Only change code below this line.",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"(function(z){return(z);})(myArray);"
@@ -455,9 +457,10 @@
"challengeSeed":[
"var ourArray = [[\"the universe\", \"everything\", 42]];",
"var myArray = [];",
+ "// Only change code below this line.",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"if(typeof(myArray) !== \"undefined\"){(function(){return(myArray);})();}"
@@ -486,9 +489,10 @@
"//var ourData = ourArray[0]; // equals 1",
"",
"var myArray = [1,2,3];",
+ "// Only change code below this line.",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"if(typeof(myArray) !== \"undefined\" && typeof(data) !== \"undefined\"){(function(y,z){return('myArray = ' + JSON.stringify(y) + ', data = ' + JSON.stringify(z));})(myArray, data);}"
@@ -516,11 +520,10 @@
"ourArray[1] = 3;",
"// ourArray[1] now equals [1,3,3].",
"var myArray = [1,2,3];",
+ "// Only change code below this line.",
"",
"",
- "",
- "",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"if(typeof(myArray) !== \"undefined\"){(function(){return(myArray);})();}"
@@ -551,9 +554,10 @@
"",
"var myArray = [\"John\", 23, [\"cat\", 2]];",
"var removed = myArray; // This should be [\"cat\", 2] and myArray should now be [\"John\", 23]",
+ "// Only change code below this line.",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z));})(myArray, removed);"
@@ -581,9 +585,10 @@
"var myArray = [\"John\", 23, [\"cat\", 2]];",
"myArray.pop();",
"//Add a [\"dog\", 3] to the end of myArray using push()",
+ "// Only change code below this line.",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"(function(z){return('myArray = ' + JSON.stringify(z));})(myArray);"
@@ -610,9 +615,10 @@
"",
"var myArray = [\"John\", 23, [\"dog\", 3]];",
"var myRemoved = myArray; // This should be [\"John\"] and myArray should now be [23, [\"dog\", 3]]",
+ "// Only change code below this line.",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & myRemoved = ' + JSON.stringify(z));})(myArray, myRemoved);"
@@ -639,10 +645,12 @@
"",
"var myArray = [\"John\", 23, [\"dog\", 3]];",
"myArray.shift();",
+ "",
"// Add \"Paul\" to the start of myArray",
+ "// Only change code below this line.",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"(function(y, z){return('myArray = ' + JSON.stringify(y));})(myArray);"
@@ -676,11 +684,12 @@
"",
"//Don't modify above this line",
"//Create a function called myFunction that returns the value of a plus b.",
+ " // Only change code below this line.",
"",
"",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"if(typeof(myFunction) !== \"undefined\"){",
@@ -726,11 +735,13 @@
"// add the name(string), legs(number), tails(number) and friends(array) properties to myDog.",
"// You can set them to whatever you want.",
"",
+ "// Only change code below this line.",
+ "",
"var myDog = {",
" ",
"};",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"(function(z){return(z);})(myDog);"
],
@@ -770,7 +781,8 @@
" \"tails\": 1,",
" \"friends\": []",
"};",
- "// Don't change any code above this line.",
+ "",
+ "// Only change code below this line.",
"",
"// Let's add the property bark to myDog",
"",
@@ -778,7 +790,7 @@
"// Now delete the property tails",
"",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"(function(z){return(z);})(myDog);"
],
@@ -857,10 +869,13 @@
"challengeSeed":[
"function myFunction() {",
" //Change the 0 to Math.random()",
+ " // Only change code below this line.",
+ "",
" return(0);",
+ "",
+ "// Only change code above this line.",
"}",
"",
- "// You can ignore everything below this line.",
"// We use this function to show you the value of your variable in your output box.",
"(function(){return(myFunction());})();"
],
@@ -888,10 +903,14 @@
"challengeSeed":[
"function myFunction(){",
" // Make myFunction return a random number between zero and nine instead of a decimal",
+ "",
+ " // Only change code below this line.",
+ "",
" return(Math.random());",
+ "",
+ " // Only change code above this line.",
"}",
"",
- "// You can ignore everything below this line.",
"// We use this function to show you the value of your variable in your output box.",
"(function(){return(myFunction());})();"
],
@@ -917,10 +936,12 @@
"var max = 12;",
"function myFunction() {",
" // Make myFunction return a random number between zero and nine instead of a decimal",
+ " // Only change code below this line.",
+ "",
" return(Math.random());",
"}",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"(function(){return(myFunction());})();"
],
@@ -954,9 +975,12 @@
" var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;",
" // Create and if else statement here to return \"heads\" if flip is 0. Otherwise return \"tails\".",
"",
+ " // Only change code below this line.",
+ "",
+ "",
"}",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"(function(){return(myFunction());})();"
],
@@ -987,11 +1011,11 @@
"var test = (function() {",
" var testString = \"John and Alan went to the shop and got some milk\";",
"",
- " //Do not modify above this line.",
+ " // Only change code below this line.",
"",
" var expression = /.+/gi;",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
" return(testString.match(expression).length);",
"})();(function(){return(test);})();"
@@ -1017,11 +1041,11 @@
"var test = (function() {",
" var testString = \"There's 3 cats but 4 dogs.\"",
"",
- "//Do Not Modify Above",
+ " // Only change code below this line.",
"",
" var expression = /.+/gi;",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
" return(testString.match(expression).length);",
"})();(function(){return(test);})();"
@@ -1046,11 +1070,11 @@
"var test = (function(){",
" var testString = \"How many spaces are there in this sentence.\";",
"",
- " // Do not modify the code above this line.",
+ " // Only change code below this line.",
"",
" var expression = /.+/gi;",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
" return(testString.match(expression).length);",
"})();(function(){return(test);})();"
@@ -1074,17 +1098,665 @@
"var test = (function(){",
" var testString = \"How many spaces are there in this sentence.\";",
"",
- " // Do not modify the code above this line.",
+ " // Only change code below this line.",
"",
" var expression = /.+/gi;",
"",
- "// You can ignore everything below this line.",
+ "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
" return(testString.match(expression).length);",
"})();(function(){return(test);})();"
],
"type": "waypoint",
"challengeType":1
+ },
+ {
+ "id":"cf1111c1c12feddfaeb9bdef",
+ "title": "Create a JavaScript Slot Machine",
+ "difficulty":"9.988",
+ "description":[
+ "We are now going to try and combine some of the stuff we've just learned and create the logic for a slot machine game.",
+ "For this we will need to generate three random numbers between 1
and 5
to represent the possible values of each individual slot.",
+ "Store the three random numbers in slotOne
, slotTwo
and slotThree
.",
+ "Generate the random numbers by using the system we used earlier:",
+ "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((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":[
+ "fccss",
+ " function runSlots(){",
+ " var slotOne;",
+ " var slotTwo;",
+ " var slotThree;",
+ " ",
+ " var images = [\"http://i.imgur.com/9H17QFk.png\", \"http://i.imgur.com/9RmpXTy.png\", \"http://i.imgur.com/VJnmtt5.png\", \"http://i.imgur.com/XK735i8.png\", \"http://i.imgur.com/Vt32Bf7.png\"];",
+ " ",
+ " // Only change code below this line.",
+ " ",
+ " ",
+ " ",
+ " // Only change code above this line.",
+ " ",
+ " $(\".logger\").html(\"\");",
+ " $(\".logger\").html(\"Not A Win\")",
+ " ",
+ " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
+ " $(\".logger\").html(slotOne + \" \" + slotTwo + \" \" + slotThree);",
+ " }",
+ " return([slotOne, slotTwo, slotThree]);",
+ " }",
+ "",
+ " $(document).ready(function(){",
+ " $(\".go\").click(function(){",
+ " runSlots();",
+ " });",
+ " });",
+ "fcces",
+ " ",
+ "
if(slotOne !== slotTwo || slotTwo !== slotThree){
",
+ " return(null);
",
+ "}
"
+ ],
+ "tests":[
+ "assert((function(){var data = runSlots();if(data === null){return(true)}else{if(data[0] === data[1] && data[1] === data[2]){return(true);}else{return(false);}}})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return null.');"
+ ],
+ "challengeSeed":[
+ "fccss",
+ " function runSlots(){",
+ " var slotOne;",
+ " var slotTwo;",
+ " var slotThree;",
+ " ",
+ " var images = [\"http://i.imgur.com/9H17QFk.png\", \"http://i.imgur.com/9RmpXTy.png\", \"http://i.imgur.com/VJnmtt5.png\", \"http://i.imgur.com/XK735i8.png\", \"http://i.imgur.com/Vt32Bf7.png\"];",
+ " ",
+ " slotOne = Math.floor(Math.random() * (5 - 1 + 1)) + 1;",
+ " slotTwo = Math.floor(Math.random() * (5 - 1 + 1)) + 1;",
+ " slotThree = Math.floor(Math.random() * (5 - 1 + 1)) + 1;",
+ " ",
+ " $(\".logger\").html(\"\");",
+ " $(\".logger\").html(\"Not A Win\")",
+ " ",
+ " // Only change code below this line.",
+ " ",
+ " ",
+ " ",
+ " // Only change code above this line.",
+ " ",
+ " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
+ " $(\".logger\").html(slotOne);",
+ " $(\".logger\").append(\" \" + slotTwo);",
+ " $(\".logger\").append(\" \" + slotThree);",
+ " }",
+ " return([slotOne, slotTwo, slotThree]);",
+ " }",
+ "",
+ " $(document).ready(function(){",
+ " $(\".go\").click(function(){",
+ " runSlots();",
+ " });",
+ " });",
+ "fcces",
+ " ",
+ "$(\".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(\"\")
",
+ "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');"
+ ],
+ "challengeSeed":[
+ "fccss",
+ " function runSlots(){",
+ " var slotOne;",
+ " var slotTwo;",
+ " var slotThree;",
+ " ",
+ " var images = [\"http://i.imgur.com/9H17QFk.png\", \"http://i.imgur.com/9RmpXTy.png\", \"http://i.imgur.com/VJnmtt5.png\", \"http://i.imgur.com/XK735i8.png\", \"http://i.imgur.com/Vt32Bf7.png\"];",
+ " ",
+ " slotOne = Math.floor(Math.random() * (5 - 1 + 1)) + 1;",
+ " slotTwo = Math.floor(Math.random() * (5 - 1 + 1)) + 1;",
+ " slotThree = Math.floor(Math.random() * (5 - 1 + 1)) + 1;",
+ " ",
+ " $(\".logger\").html(\"\");",
+ " $(\".logger\").html(\"Not A Win\")",
+ " ",
+ " // Only change code below this line.",
+ " ",
+ " ",
+ " ",
+ " // Only change code above this line.",
+ " ",
+ " if(slotOne !== slotTwo || slotTwo !== slotThree){",
+ " return(null);",
+ " }",
+ " ",
+ " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
+ " $(\".logger\").html(slotOne);",
+ " $(\".logger\").append(\" \" + slotTwo);",
+ " $(\".logger\").append(\" \" + slotThree);",
+ " }",
+ " ",
+ " return([slotOne, slotTwo, slotThree]);",
+ " }",
+ "",
+ " $(document).ready(function(){",
+ " $(\".go\").click(function(){",
+ " runSlots();",
+ " });",
+ " });",
+ "fcces",
+ " ",
+ "$($('.slot')[0]).html('<img src = \"' + images[slotOne-1] + '\">');
"
+ ],
+ "tests":[
+ "assert(editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[\\d\\]\\)\\.html\\(\\'\\motorBike
object the correct attributes."
],
"tests":[
"assert(motorBike.wheels===2, 'You should have given motorBike two wheels');",
@@ -47,7 +48,8 @@
"title":"Waypoint: Constructing Objects",
"difficulty":0,
"description":[
- "We are also able to create Objects using functions"
+ "We are also able to create objects using functions.",
+ ""
],
"tests":[
"assert((new Car()).wheels === 4, \"myCar.wheels should be four. Make sure that you haven't changed this value\");",
@@ -55,12 +57,11 @@
"assert(typeof((new Car()).seats) === 'number', 'myCar.seats should be a number');"
],
"challengeSeed":[
- "//Let's add the properties engine and seats to the car in the same way that the property wheels has been added below. They should both be numbers",
+ "// Let's add the properties engine and seats to the car in the same way that the property wheels has been added below. They should both be numbers.",
"var Car = function(){",
" this.wheels = 4;",
"};",
"",
- "//Instantiated Here",
"var myCar = new Car();",
"",
"(function(){return(JSON.stringify(myCar));})();"