From f57459f0396ed8837170b5933e38b802d905a6c7 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Sun, 27 Dec 2015 12:23:58 -0800 Subject: [PATCH] Corrections from Live Stream --- .../basic-javascript.json | 194 +++++++++--------- 1 file changed, 101 insertions(+), 93 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index f22792c3a7..b1af365971 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -87,7 +87,7 @@ "id": "56533eb9ac21ba0edf2244a8", "title": "Storing Values with the Equal Operator", "description": [ - "In Javascript, you can store a value in a variable with the = or assignment operator.", + "In Javascript, you can store a value in a variable with the assignment or equal (=) operator.", "myVariable = 5;", "Assigns the Number value 5 to myVariable.", "Assignment always goes from right to left. Everything to the right of the = operator is resolved before the value is assigned to the variable to the left of the operator.", @@ -225,7 +225,7 @@ "Examples:", "
var someVariable;
var anotherVariableName;
var thisVariableNameIsTooLong;
", "

Instructions

", - "Correct the variable assignements so their names match their variable declarations above." + "Correct the variable assignments so their names match their variable declarations above." ], "releasedOn": "11/27/2015", "tests": [ @@ -272,7 +272,7 @@ "JavaScript uses the + symbol as addition operation when placed between two numbers.", "", "Example", - "
5 + 10 = 15
", + "
myVar = 5 + 10; // assigned 15
", "", "

Instructions

", "Change the 0 so that sum will equal 20." @@ -299,10 +299,10 @@ "JavaScript uses the - symbol for subtraction.", "", "Example", - "
12 - 6 = 6
", + "
myVAr = 12 - 6; // assigned 6
", "", "

Instructions

", - "Change the 0 so that difference will equal 12." + "Change the 0 so the difference is 12." ], "tests": [ "assert(difference === 12, 'message: Make the variable difference equal 12.');", @@ -330,7 +330,7 @@ "JavaScript uses the * symbol for multiplication of two numbers.", "", "Example", - "
13 * 13 = 169
", + "
myVar = 13 * 13; // assigned 169
", "", "

Instructions

", "Change the 0 so that product will equal 80." @@ -361,10 +361,10 @@ "JavaScript uses the / symbol for division.", "", "Example", - "
16 / 2 = 8
", + "
myVar = 16 / 2; // assigned 8
", "", "

Instructions

", - "Change the 0 so that quotient will equal to 2." + "Change the 0 so that the quotient is equal to 2." ], "tests": [ "assert(quotient === 2, 'message: Make the variable quotient equal to 2.');", @@ -387,7 +387,7 @@ "description": [ "You can easily increment or add one to a variable with the ++ operator.", "i++;", - "is the equivilent of", + "is the equivalent of", "i = i + 1;", "

Instructions

", "Change the code to use the ++ operator on myVar" @@ -426,7 +426,7 @@ "description": [ "You can easily decrement or decrease a variable by one with the -- operator.", "i--;", - "is the equivilent of", + "is the equivalent of", "i = i - 1;", "

Instructions

", "Change the code to use the -- operator on myVar" @@ -466,8 +466,8 @@ "We can store decimal numbers in variables too. Decimal numbers are sometimes refered to as floating point numbers or floats. ", "Note", "Not all real numbers can accurately be represented in floating point. This can lead to rounding errors. Details Here.", - "", - "Let's create a variable myDecimal and give it a decimal value." + "

Instructions

", + "Create a variable myDecimal and give it a decimal value." ], "tests": [ "assert(typeof myDecimal === \"number\", 'message: myDecimal should be a number.');", @@ -492,6 +492,7 @@ "description": [ "In JavaScript, you can also perform calculations with decimal numbers, just like whole numbers.", "Let's multiply two decimals together to get their product.", + "

Instructions

", "Change the 0.0 so that product will equal 5.0." ], "tests": [ @@ -514,6 +515,7 @@ "title": "Divide one Decimal by Another with JavaScript", "description": [ "Now let's divide one decimal by another.", + "

Instructions

", "Change the 0.0 so that quotient will equal to 2.2." ], "tests": [ @@ -533,16 +535,18 @@ }, { "id": "56533eb9ac21ba0edf2244ae", - "title": "Find a Remainder with Modulus", + "title": "Finding a Remainder in Javascript", "description": [ - "The modulus operator % gives the remainder of the division of two numbers.", + "The remainder operator % gives the remainder of the division of two numbers. ", "Example", "
5 % 2 = 1 because
Math.floor(5 / 2) = 2 (Quotient)
2 * 2 = 4
5 - 4 = 1 (Remainder)
", "Usage", - "In Maths, a number can be checked even or odd by checking the remainder of division of the number by 2. ", + "In mathematics, a number can be checked even or odd by checking the remainder of division of the number by 2. ", "
17 % 2 = 1 (17 is Odd)
48 % 2 = 0 (48 is Even)
", + "Note", + "The remainder operator is sometimes incorrectly refered to as the \"modulus\" operator. It is very similar to modulus, but does not work properly with negative numbers.", "

Instructions

", - "Set remainder equal to the remainder of 11 divided by 3 using the modulus operator." + "Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator." ], "releasedOn": "11/27/2015", "tests": [ @@ -917,6 +921,9 @@ "", "" ], + "tail": [ + "(function() { return \"myStr = \" + myStr; })();" + ], "solutions": [ "var myStr = 'Link';" ], @@ -1358,7 +1365,7 @@ "releasedOn": "11/27/2015", "tests": [ "assert(typeof wordBlanks(\"\",\"\",\"\",\"\") === 'string', 'message: wordBlanks(\"\",\"\",\"\",\"\") should return a string');", - "assert(wordBlanks(\"\",\"\",\"\",\"\").length > 50, 'message: wordBlanks(\"\",\"\",\"\",\"\") should return at least 50 characters with empty inputs');", + "assert(wordBlanks(\"\",\"\",\"\",\"\").length > 30, 'message: wordBlanks(\"\",\"\",\"\",\"\") should return at least 30 characters with empty inputs');", "assert(/dog/.test(test1) && /big/.test(test1) && /ran/.test(test1) && /quickly/.test(test1),'message: wordBlanks(\"dog\", \"big\", \"ran\", \"quickly\") should contain all of the passed words.');", "assert(/cat/.test(test2) && /little/.test(test2) && /hit/.test(test2) && /slowly/.test(test2),'message: wordBlanks(\"cat\", \"little\", \"hit\", \"slowly\") should contain all of the passed words.');" ], @@ -2820,78 +2827,6 @@ "nameEs": "", "namePt": "" }, - { - "id": "5664820f61c48e80c9fa476c", - "title": "Golf Code", - "description": [ - "In the game of golf each hole has a par for the average number of strokes needed to sink the ball. Depending on how far above or below par your stokes are, there is a different nickname.", - "Your function will be passed a par and strokes. Return strings according to this table (based on order of priority - top (highest) to bottom (lowest)):", - "
StokesReturn
1\"Hole-in-one!\"
<= par - 2\"Eagle\"
par - 1\"Birdie\"
par\"Par\"
par + 1\"Bogey\"
par + 2\"Double Bogey\"
>= par + 3\"Go Home!\"
", - "par and strokes will always be numeric and positive." - ], - "releasedOn": "11/27/2015", - "tests": [ - "assert(golfScore(4, 1) === \"Hole-in-one!\", 'message: golfScore(4, 1) should return \"Hole-in-one!\"');", - "assert(golfScore(4, 2) === \"Eagle\", 'message: golfScore(4, 2) should return \"Eagle\"');", - "assert(golfScore(5, 2) === \"Eagle\", 'message: golfScore(4, 2) should return \"Eagle\"');", - "assert(golfScore(4, 3) === \"Birdie\", 'message: golfScore(4, 3) should return \"Birdie\"');", - "assert(golfScore(4, 4) === \"Par\", 'message: golfScore(4, 4) should return \"Par\"');", - "assert(golfScore(1, 1) === \"Hole-in-one!\", 'message: golfScore(1, 1) should return \"Hole-in-one!\"');", - "assert(golfScore(5, 5) === \"Par\", 'message: golfScore(5, 5) should return \"Par\"');", - "assert(golfScore(4, 5) === \"Bogey\", 'message: golfScore(4, 5) should return \"Bogey\"');", - "assert(golfScore(4, 6) === \"Double Bogey\", 'message: golfScore(4, 6) should return \"Double Bogey\"');", - "assert(golfScore(4, 7) === \"Go Home!\", 'message: golfScore(4, 7) should return \"Go Home!\"');", - "assert(golfScore(5, 9) === \"Go Home!\", 'message: golfScore(5, 9) should return \"Go Home!\"');" - ], - "challengeSeed": [ - "function golfScore(par, strokes) {", - " // Only change code below this line", - " ", - " ", - " return \"Change Me\";", - " // Only change code above this line", - "}", - "", - "// Change these values to test", - "golfScore(5, 4);" - ], - "solutions": [ - "function golfScore(par, strokes) {", - " if (strokes === 1) {", - " return \"Hole-in-one!\";", - " }", - " ", - " if (strokes <= par - 2) {", - " return \"Eagle\";", - " }", - " ", - " if (strokes === par - 1) {", - " return \"Birdie\";", - " }", - " ", - " if (strokes === par) {", - " return \"Par\";", - " }", - " ", - " if (strokes === par + 1) {", - " return \"Bogey\";", - " }", - " ", - " if(strokes === par + 2) {", - " return \"Double Bogey\";", - " }", - " ", - " return \"Go Home!\";", - "}" - ], - "type": "bonfire", - "challengeType": "5", - "nameCn": "", - "nameFr": "", - "nameRu": "", - "nameEs": "", - "namePt": "" - }, { "id": "56533eb9ac21ba0edf2244da", "title": "Introducing Else Statements", @@ -3066,6 +3001,78 @@ "nameEs": "", "namePt": "" }, + { + "id": "5664820f61c48e80c9fa476c", + "title": "Golf Code", + "description": [ + "In the game of golf each hole has a par for the average number of strokes needed to sink the ball. Depending on how far above or below par your strokes are, there is a different nickname.", + "Your function will be passed a par and strokes. Return strings according to this table (based on order of priority - top (highest) to bottom (lowest)):", + "
StrokesReturn
1\"Hole-in-one!\"
<= par - 2\"Eagle\"
par - 1\"Birdie\"
par\"Par\"
par + 1\"Bogey\"
par + 2\"Double Bogey\"
>= par + 3\"Go Home!\"
", + "par and strokes will always be numeric and positive." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(golfScore(4, 1) === \"Hole-in-one!\", 'message: golfScore(4, 1) should return \"Hole-in-one!\"');", + "assert(golfScore(4, 2) === \"Eagle\", 'message: golfScore(4, 2) should return \"Eagle\"');", + "assert(golfScore(5, 2) === \"Eagle\", 'message: golfScore(5, 2) should return \"Eagle\"');", + "assert(golfScore(4, 3) === \"Birdie\", 'message: golfScore(4, 3) should return \"Birdie\"');", + "assert(golfScore(4, 4) === \"Par\", 'message: golfScore(4, 4) should return \"Par\"');", + "assert(golfScore(1, 1) === \"Hole-in-one!\", 'message: golfScore(1, 1) should return \"Hole-in-one!\"');", + "assert(golfScore(5, 5) === \"Par\", 'message: golfScore(5, 5) should return \"Par\"');", + "assert(golfScore(4, 5) === \"Bogey\", 'message: golfScore(4, 5) should return \"Bogey\"');", + "assert(golfScore(4, 6) === \"Double Bogey\", 'message: golfScore(4, 6) should return \"Double Bogey\"');", + "assert(golfScore(4, 7) === \"Go Home!\", 'message: golfScore(4, 7) should return \"Go Home!\"');", + "assert(golfScore(5, 9) === \"Go Home!\", 'message: golfScore(5, 9) should return \"Go Home!\"');" + ], + "challengeSeed": [ + "function golfScore(par, strokes) {", + " // Only change code below this line", + " ", + " ", + " return \"Change Me\";", + " // Only change code above this line", + "}", + "", + "// Change these values to test", + "golfScore(5, 4);" + ], + "solutions": [ + "function golfScore(par, strokes) {", + " if (strokes === 1) {", + " return \"Hole-in-one!\";", + " }", + " ", + " if (strokes <= par - 2) {", + " return \"Eagle\";", + " }", + " ", + " if (strokes === par - 1) {", + " return \"Birdie\";", + " }", + " ", + " if (strokes === par) {", + " return \"Par\";", + " }", + " ", + " if (strokes === par + 1) {", + " return \"Bogey\";", + " }", + " ", + " if(strokes === par + 2) {", + " return \"Double Bogey\";", + " }", + " ", + " return \"Go Home!\";", + "}" + ], + "type": "bonfire", + "challengeType": "5", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, { "id": "56533eb9ac21ba0edf2244dd", "title": "Selecting from many options with Switch Statements", @@ -3450,7 +3457,7 @@ "In the casino game Blackjack, a player can gain an advantage over the house by keeping track of the relative number of high and low cards remaining in the deck. This is called Card Counting. ", "Having more high cards remaining in the deck favors the player. Each card is assigned a value according to the table below. When the count is positive, the player should bet high. When the count is zero or negative, the player should bet low.", "
ValueCards
+12, 3, 4, 5, 6
07, 8, 9
-110, 'J', 'Q', 'K','A'
", - "You will write a card counting function. It will recieve a card parameter and increment or decrement the global count variable according to the card's value (see table). The function will then return the current count and the string \"Bet\" if the count if positive, or \"Hold\" if the count is zero or negative.", + "You will write a card counting function. It will receive a card parameter and increment or decrement the global count variable according to the card's value (see table). The function will then return the current count and the string \"Bet\" if the count if positive, or \"Hold\" if the count is zero or negative.", "Example Output", "-3 Hold
5 Bet" ], @@ -4017,7 +4024,7 @@ "JavaScript Object Notation or JSON uses the format of Javascript Objects to store data. JSON is flexible becuase it allows for data structures with arbitrary combinations of strings, numbers, booleans, arrays, and objects. ", "Here is an example of a JSON object:", "
var ourMusic = [
{
\"artist\": \"Daft Punk\",
\"title\": \"Homework\",
\"release_year\": 1997,
\"formats\": [
\"CD\",
\"Cassette\",
\"LP\" ],
\"gold\": true
}
];
", - "This is an array of objects and the object has various peices of metadata about an album. It also has a nested array of formats. Additional album records could be added to the top level array.", + "This is an array of objects and the object has various pieces of metadata about an album. It also has a nested array of formats. Additional album records could be added to the top level array.", "

Instructions

", "Add a new album to the myMusic JSON object. Add artist and title strings, release_year year, and a formats array of strings." ], @@ -4234,7 +4241,7 @@ "id": "56533eb9ac21ba0edf2244cf", "title": "Record Collection", "description": [ - "You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unqiue id number and which has several properties. Not all albums have complete information.", + "You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unique id number and which has several properties. Not all albums have complete information.", "Write a function which takes an id, a property (prop), and a value.", "For the given id in collection:", "If value is non-blank (value !== \"\"), then update or set the value for the prop.", @@ -4250,6 +4257,7 @@ "update(2548, \"tracks\", \"\"); assert(!collection[2548].hasOwnProperty(\"tracks\"), 'message: After update(2548, \"tracks\", \"\"), tracks should not be set');" ], "challengeSeed": [ + "// Setup", "var collection = {", " 2548: {", " album: \"Slippery When Wet\",", @@ -5572,4 +5580,4 @@ "challengeType": "0" } ] -} +} \ No newline at end of file