diff --git a/seed/challenges/angularjs.json b/seed/challenges/angularjs.json index 304e86ed3c..7a3155ed4f 100644 --- a/seed/challenges/angularjs.json +++ b/seed/challenges/angularjs.json @@ -1,6 +1,6 @@ { "name": "AngularJS", - "order": 0.017, + "order": 0.014, "challenges": [ { "id": "bd7154d8c441eddfaeb5bdef", diff --git a/seed/challenges/automated-testing-and-debugging.json b/seed/challenges/automated-testing-and-debugging.json index 4a3d67e162..a62368eee0 100644 --- a/seed/challenges/automated-testing-and-debugging.json +++ b/seed/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/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index b219af3adc..d4288164fb 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/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);" @@ -450,14 +452,15 @@ "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(/\\[\\s?\\[/g).length >= 1 && editor.getValue().match(/\\]\\s?\\]/g).length >= 1){return(true);}else{return(false);}})(), 'myArray should contain at least one array');" + "assert(Array.isArray(myArray) && myArray.some(Array.isArray), 'myArray should have at least one array nested within another array.');" ], "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());})();" ], @@ -968,32 +992,31 @@ "title": "Sift through Text with Regular Expressions", "difficulty":"9.984", "description":[ - "RegEx is a powerful tool we can use to find certain words or patterns in strings.", - "RegEx can look difficult at first but there's not much to getting it working.", - "If we wanted to find the number of times the word the occurred in the string The dog chased the cat We could use the following RegEx:", - "\/the+\/gi", + "Regular expressions are way to find certain words or patterns inside of strings.", + "For example, if we wanted to find the number of times the word the occurred in the string The dog chased the cat, we could use the following regular expression: \/the+\/gi", "Let's break this down a bit:", "the is the pattern we want to match.", - "+ means we are looking for one or more occurrences of this pattern.", - "g means that it searches the entire string.", - "i means that we are ignoring the case (uppercase or lowercase) of what we are looking for.", - "Let's try finding the word and in the string John and Alan went to the shop and got some milk by replacing the .+ in the current RegEx with something that will find the word and and count how many times it occurs." + "+ means we want to find one or more occurrences of this pattern.", + "g means that we want to search the entire string for this pattern.", + "i means that we want to ignore the case (uppercase or lowercase) when searching for the pattern.", + "Regular expressions are usually surrounded by / symbols.", + "Let's try selecting all the occurances of the word and in the string George Boole and Alan Turing went to the shop and got some milk. We can do this by replacing the .+ part of our regular expression with the current regular expression with the word and." ], "tests":[ - "assert(test==2, 'Your regular expression should have found two occurrences of the word and');", + "assert(test==2, 'Your regular expression should find two occurrences of the word and');", "assert(editor.getValue().match(/\\/and\\+\\/gi/), 'You should have used regular expressions to find the word and');" ], "challengeSeed":[ "var test = (function() {", - " var testString = \"John and Alan went to the shop and got some milk\";", - "", - " //Do not modify above this line.", + " var testString = \"George Boole and Alan Turing went to the shop and got some milk\";", + " var expressionToGetMilk = /milk/gi;", + " // Only change code below this line.", "", " var expression = /.+/gi;", "", - "// You can ignore everything below this line.", - "// We use this function to show you the value of your variable in your output box.", - " return(testString.match(expression).length);", + " // 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", @@ -1004,10 +1027,10 @@ "title": "Find Numbers with Regular Expressions", "difficulty":"9.985", "description":[ - "We can use special selectors in RegEx to select a particular type of value.", + "We can use special selectors in Regular Expressions to select a particular type of value.", "One such selector is the digit selector \\d which is used to grab the numbers in a string.", - "It is used like this:", - "/\\d+/g" + "It is used like this: /\\d+/g.", + "Use the \\d selector to select the number of numbers in the string." ], "tests":[ "assert(test === 2, 'Your RegEx should have found two numbers in the testString');", @@ -1015,15 +1038,15 @@ ], "challengeSeed":[ "var test = (function() {", - " var testString = \"There's 3 cats but 4 dogs.\"", + " 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.", - "// We use this function to show you the value of your variable in your output box.", - " return(testString.match(expression).length);", + " // 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", @@ -1046,11 +1069,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 +1097,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", + " ", + "
", + "
", + "
", + " \"learn", + "

FCC Slot Machine

", + "
", + "
", + "
", + " ", + "
", + "
", + " ", + "
", + "
", + " ", + "
", + "
", + "
", + "
", + " ", + "
", + "
", + "
", + " ", + "
", + "
", + "
", + "", + "" + ], + "type": "waypoint", + "challengeType": 0 + }, + { + "id":"cf1111c1c13feddfaeb1bdef", + "title": "Add your JavaScript Slot Machine Slots", + "difficulty":"9.989", + "description":[ + "Now that we have our random numbers we need to go and check for when they are all the same that means we should count it as a win.", + "Different numbers will have different values so we need to return the matched number or null.", + "If we get a match we should change the value of win to the number that we have three of or leave it as null.", + "Let's create an if statement with multiple conditions to check that all the numbers are equal.", + "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", + " ", + "
", + "
", + "
", + " \"learn", + "

FCC Slot Machine

", + "
", + "
", + "
", + " ", + "
", + "
", + " ", + "
", + "
", + " ", + "
", + "
", + "
", + "
", + " ", + "
", + "
", + "
", + " ", + "
", + "
", + "
", + "", + "" + ], + "type": "waypoint", + "challengeType": 0 + }, + { + "id":"cf1111c1c13feddfaeb2bdef", + "title": "Bring your JavaScript Slot Machine to Life", + "difficulty":"9.990", + "description":[ + "Now we can detect a win. Let's get this slot machine working.", + "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(\"\")", + "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", + " ", + "
", + "
", + "
", + " \"learn", + "

FCC Slot Machine

", + "
", + "
", + "
", + " ", + "
", + "
", + " ", + "
", + "
", + " ", + "
", + "
", + "
", + "
", + " ", + "
", + "
", + "
", + " ", + "
", + "
", + "
", + "", + "" + ], + "type": "waypoint", + "challengeType": 0 + }, + { + "id":"cf1111c1c11feddfaeb1bdff", + "title": "Give your JavaScript Slot Machine some stylish images", + "difficulty":"9.9901", + "description":[ + "Now that we can detect when the player wins we are going to add an image to each slot depending on the random values we generate:", + "$($('.slot')[0]).html('<img src = \"' + images[slotOne-1] + '\">');" + ], + "tests":[ + "assert(editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[\\d\\]\\)\\.html\\(\\'\\\\'\\);/gi) && editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[\\d\\]\\)\\.html\\(\\'\\\\'\\);/gi).length >= 3, 'Use the provided code three times. One for each slot');", + "assert(editor.match(/slotOne/gi) && editor.match(/slotOne/gi).length >= 7, 'You should have used the slotOne value at least once');", + "assert(editor.match(/slotTwo/gi) && editor.match(/slotTwo/gi).length >=8, 'You should have used the slotTwo value at least once');", + "assert(editor.match(/slotThree/gi) && editor.match(/slotThree/gi).length >= 7, 'You should have used the slotThree value at least once');" + ], + "challengeSeed":[ + "fccss", + " function runSlots(){", + " var slotOne;", + " var slotTwo;", + " var slotThree;", + " ", + " 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", + " ", + "
", + "
", + "
", + " ", + "

FCC Slot Machine

", + "
", + "
", + "
", + " ", + "
", + "
", + " ", + "
", + "
", + " ", + "
", + "
", + "
", + "
", + " ", + "
", + "
", + "
", + " ", + "
", + "
", + "
", + "", + "" + ], + "type": "waypoint", + "challengeType": 0 } ] } diff --git a/seed/challenges/git.json b/seed/challenges/git.json index 3141e65112..7b091e8fb7 100644 --- a/seed/challenges/git.json +++ b/seed/challenges/git.json @@ -1,6 +1,6 @@ { "name": "Git", - "order" : 0.014, + "order" : 0.016, "challenges": [ { "id": "bd7353d8c341eddeaeb5bd0f", diff --git a/seed/challenges/html5-and-css.json b/seed/challenges/html5-and-css.json index d3a44025d5..466c49353a 100644 --- a/seed/challenges/html5-and-css.json +++ b/seed/challenges/html5-and-css.json @@ -438,7 +438,7 @@ "tests": [ "assert($(\"h2\").css(\"color\") === \"rgb(255, 0, 0)\", 'Your h2 element should be red.')", "assert($(\"h2\").hasClass(\"red-text\"), 'Your h2 element should have the class red-text.')", - "assert($(\"h2\").attr(\"style\") === undefined, 'Don't use inline style declarations like style=\"color: red\" in your h2 element.')" + "assert($(\"h2\").attr(\"style\") === undefined, 'Do not use inline style declarations like style=\"color: red\" in your h2 element.')" ], "challengeSeed": [ "