From 01d71ca1d92feb6bda6860f9f643effc94ae555d Mon Sep 17 00:00:00 2001 From: Roger Turnau Date: Fri, 14 Aug 2015 16:29:16 -0400 Subject: [PATCH 1/8] Added improved instructions to Least Common Multiple Bonfire. --- seed/challenges/intermediate-bonfires.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/intermediate-bonfires.json b/seed/challenges/intermediate-bonfires.json index 954d402ce9..c47d55b9ef 100644 --- a/seed/challenges/intermediate-bonfires.json +++ b/seed/challenges/intermediate-bonfires.json @@ -547,7 +547,7 @@ "title": "Smallest Common Multiple", "difficulty": "2.11", "description": [ - "Find the smallest number that is evenly divisible by all numbers in the provided range.", + "Find the smallest number that is evenly divisible by all numbers in the provided range. In other words, given the range [3,7], you will need to find the least common multiple of 3, 4, 5, 6, and 7.", "The range will be an array of two numbers that will not necessarily be in numerical order.", "Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code." ], From fa454cfdd4c8cf69b44e5a609e5b7f2bfc9c1967 Mon Sep 17 00:00:00 2001 From: Isabell Long Date: Sat, 15 Aug 2015 19:53:04 +0100 Subject: [PATCH 2/8] Close a tag so that only actual code is marked - Fixes #1767, hopefully. --- seed/challenges/html5-and-css.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/html5-and-css.json b/seed/challenges/html5-and-css.json index d3a44025d5..36744e2f9c 100644 --- a/seed/challenges/html5-and-css.json +++ b/seed/challenges/html5-and-css.json @@ -538,7 +538,7 @@ "title": "Change the Font Size of an Element", "difficulty": 1.13, "description": [ - "Create a second p element with the following kitty ipsum text: Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.", + "Create a second p element with the following kitty ipsum text: Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.", "Then, inside your <style> element, set the font-size of all p elements to 16 pixels.", "Font size is controlled by the font-size CSS attribute, like this: h1 { font-size: 30px; }.", "See if you can figure out how to give both of your p elements the font-size of 16 pixels (16px). You can do this inside the same <style> tag that we created for your red-text class." From f2ee2e4031877cb804430018a7b29f0ed0808613 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sat, 15 Aug 2015 13:57:44 -0700 Subject: [PATCH 3/8] update JavaScript challenges --- .../automated-testing-and-debugging.json | 40 +- seed/challenges/basic-javascript.json | 754 +++++++++++++++++- ...t-oriented-and-functional-programming.json | 9 +- 3 files changed, 739 insertions(+), 64 deletions(-) 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..485e32772f 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);" @@ -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", + " ", + "
", + "
", + "
", + " \"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/object-oriented-and-functional-programming.json b/seed/challenges/object-oriented-and-functional-programming.json index c7334bf9d7..33de956faf 100644 --- a/seed/challenges/object-oriented-and-functional-programming.json +++ b/seed/challenges/object-oriented-and-functional-programming.json @@ -15,7 +15,8 @@ "title":"Waypoint: A Review On Objects", "difficulty":0, "description":[ - "Before we dive into Object Oriented Programming Let's take a quick look over objects in javascript" + "Before we dive into Object Oriented Programming, let's revisit JavaScript objects.", + "Give your 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));})();" From 38ceeee635006f29a21d80d382f3605373445df6 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Sat, 15 Aug 2015 14:04:01 -0700 Subject: [PATCH 4/8] Update intermediate-bonfires.json --- seed/challenges/intermediate-bonfires.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/seed/challenges/intermediate-bonfires.json b/seed/challenges/intermediate-bonfires.json index c47d55b9ef..10c1c35bcf 100644 --- a/seed/challenges/intermediate-bonfires.json +++ b/seed/challenges/intermediate-bonfires.json @@ -547,7 +547,8 @@ "title": "Smallest Common Multiple", "difficulty": "2.11", "description": [ - "Find the smallest number that is evenly divisible by all numbers in the provided range. In other words, given the range [3,7], you will need to find the least common multiple of 3, 4, 5, 6, and 7.", + "Find the smallest number that is evenly divisible by all numbers in the provided range.", + "In other words, given the range [3,7], you will need to find the least common multiple of 3, 4, 5, 6, and 7.", "The range will be an array of two numbers that will not necessarily be in numerical order.", "Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code." ], From e3404c6564173e07ab52fdcf53aacf52df5200e0 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sat, 15 Aug 2015 14:13:21 -0700 Subject: [PATCH 5/8] minor improvements and bug fixes to stories --- server/boot/story.js | 1 - server/views/stories/show.jade | 23 +++++++++++------------ server/views/stories/submit-story.jade | 7 ------- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/server/boot/story.js b/server/boot/story.js index 8be0735421..0a2af6d96c 100755 --- a/server/boot/story.js +++ b/server/boot/story.js @@ -167,7 +167,6 @@ module.exports = function(app) { originalStoryLink: dashedName, originalStoryAuthorEmail: story.author.email || '', author: story.author, - description: story.description, rank: story.upVotes.length, upVotes: story.upVotes, id: story.id, diff --git a/server/views/stories/show.jade b/server/views/stories/show.jade index 7d9ddbeb7f..20c6346e01 100644 --- a/server/views/stories/show.jade +++ b/server/views/stories/show.jade @@ -23,19 +23,18 @@ h3.row .col-xs-12.col-sm-12.col-md-6 h4= storyMetaDescription .col-xs-12 - h4= description - .negative-5 - if !hasUserVoted - a#upvote.btn.btn-no-shadow.btn-primary.btn-xs.btn-primary-ghost Upvote - |  ·  - else - a#upvote.btn.disabled.btn-no-shadow.btn-primary.btn-xs.btn-primary-ghost Upvoted! - |  ·  - span#storyRank= rank + (rank > 1 ? " points" : " point") + .spacer + if !hasUserVoted + a#upvote.btn.btn-no-shadow.btn-primary.btn-xs.btn-primary-ghost Upvote |  ·  - span Posted #{timeAgo} - span  by  - a(href="/" + author.username) @#{author.username} + else + a#upvote.btn.disabled.btn-no-shadow.btn-primary.btn-xs.btn-primary-ghost Upvoted! + |  ·  + span#storyRank= rank + (rank > 1 ? " points" : " point") + |  ·  + span Posted #{timeAgo} + span  by  + a(href="/" + author.username) @#{author.username} script. if (image) { diff --git a/server/views/stories/submit-story.jade b/server/views/stories/submit-story.jade index dda1aa63ea..21baa0afd1 100644 --- a/server/views/stories/submit-story.jade +++ b/server/views/stories/submit-story.jade @@ -45,10 +45,3 @@ if (storyImage) { $('#image-display').removeClass('hidden-element'); } - var text_max = 140; - $('#textarea_feedback').html(text_max + ' characters remaining'); - $('#description-box').keyup(function () { - var text_length = $('#description-box').val().length; - var text_remaining = text_max - text_length; - $('#textarea_feedback').html(text_remaining + ' characters remaining'); - }); From c8f44d98bf3a0e81218cf1e99452320abe6c943a Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sat, 15 Aug 2015 14:23:10 -0700 Subject: [PATCH 6/8] resequence some challenges --- seed/challenges/angularjs.json | 2 +- seed/challenges/git.json | 2 +- seed/challenges/intermediate-ziplines.json | 2 +- seed/challenges/mongodb.json | 2 +- seed/challenges/nodejs-and-expressjs.json | 2 +- seed/challenges/object-oriented-and-functional-programming.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) 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/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/intermediate-ziplines.json b/seed/challenges/intermediate-ziplines.json index 375cf2386c..0a0c57f85c 100644 --- a/seed/challenges/intermediate-ziplines.json +++ b/seed/challenges/intermediate-ziplines.json @@ -1,6 +1,6 @@ { "name": "Intermediate Front End Development Projects", - "order": 0.018, + "order": 0.015, "challenges": [ { "id": "bd7158d8c442eddfaeb5bd18", diff --git a/seed/challenges/mongodb.json b/seed/challenges/mongodb.json index 1751c617d8..63d4ec673f 100644 --- a/seed/challenges/mongodb.json +++ b/seed/challenges/mongodb.json @@ -1,6 +1,6 @@ { "name": "MongoDB", - "order" : 0.016, + "order" : 0.018, "challenges": [ { "id": "bd7243d8c341eddeaeb5bd0f", diff --git a/seed/challenges/nodejs-and-expressjs.json b/seed/challenges/nodejs-and-expressjs.json index ed6298910d..c8364e4e36 100644 --- a/seed/challenges/nodejs-and-expressjs.json +++ b/seed/challenges/nodejs-and-expressjs.json @@ -1,6 +1,6 @@ { "name": "Node.js and Express.js", - "order" : 0.015, + "order" : 0.017, "challenges": [ { "id": "bd7153d8c441eddfaeb5bd0f", diff --git a/seed/challenges/object-oriented-and-functional-programming.json b/seed/challenges/object-oriented-and-functional-programming.json index 33de956faf..85e4a41c12 100644 --- a/seed/challenges/object-oriented-and-functional-programming.json +++ b/seed/challenges/object-oriented-and-functional-programming.json @@ -1,6 +1,6 @@ { "name": "Object Oriented and Functional Programming", - "order": 0.009, + "order": 0.010, "note": [ "Waypoint: Closures", "Waypoint: Factories", From 40e14c399961b7a8a95b511b337610b3ac859892 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sat, 15 Aug 2015 15:33:21 -0700 Subject: [PATCH 7/8] fix critical failing test in early waypoint --- seed/challenges/basic-javascript.json | 23 ++++++++++------------- seed/challenges/html5-and-css.json | 2 +- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index 485e32772f..5a6875548a 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -992,25 +992,23 @@ "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 ignoring the case (uppercase or lowercase) when searching for the pattern.", + "Let's try counting the number of times the word and occurs in the string John and Alan 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\";", - "", + " var expressionToGetMilk = /milk/gi;", " // Only change code below this line.", "", " var expression = /.+/gi;", @@ -1028,10 +1026,9 @@ "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" ], "tests":[ "assert(test === 2, 'Your RegEx should have found two numbers in the testString');", diff --git a/seed/challenges/html5-and-css.json b/seed/challenges/html5-and-css.json index 36744e2f9c..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": [ "