From 5faa298336658300f77500a229560125b71c9f68 Mon Sep 17 00:00:00 2001 From: Logan Tegman Date: Thu, 31 Dec 2015 22:04:22 -0800 Subject: [PATCH] Fix sentence spacing --- .../basic-javascript.json | 142 +++++++++--------- 1 file changed, 71 insertions(+), 71 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 d3e05bb9cc..a9097fa45f 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -17,7 +17,7 @@ "Try creating one of each type of comment." ], "challengeSeed": [ - " " + "" ], "solutions": [ "// Fake Comment\n/* Another Comment */" @@ -45,7 +45,7 @@ "", "// Only change code below this line.", "", - " return false; // Change this line", + "return false; // Change this line", "", "// Only change code above this line.", "}" @@ -102,7 +102,7 @@ "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.", + "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.", "myVar = 5;", "myNum = myVar;", "Assigns 5 to myVar and then resolves myVar to 5 again and assigns it to myNum.", @@ -180,7 +180,7 @@ "id": "56533eb9ac21ba0edf2244aa", "title": "Understanding Uninitialized Variables", "description": [ - "When JavaScript variables are declared, they have an initial value of undefined. If you do a mathematical operation on an undefined variable your result will be NaN which means \"Not a Number\". If you concatenate a string with an undefined variable, you will get a literal string of \"undefined\".", + "When JavaScript variables are declared, they have an initial value of undefined. If you do a mathematical operation on an undefined variable your result will be NaN which means \"Not a Number\". If you concatenate a string with an undefined variable, you will get a literal string of \"undefined\".", "

Instructions

", "Initialize the three variables a, b, and c with 5, 10, and \"I am a\" respectively so that they will not be undefined." ], @@ -222,8 +222,8 @@ "id": "56533eb9ac21ba0edf2244ab", "title": "Understanding Case Sensitivity in Variables", "description": [ - "In JavaScript all variables and function names are case sensitive. This means that capitalization matters.", - "MYVAR is not the same as MyVar nor myvar. It is possible to have multiple distinct variables with the same name but different casing. It is strongly recommended that for the sake of clarity, you do not use this language feature.", + "In JavaScript all variables and function names are case sensitive. This means that capitalization matters.", + "MYVAR is not the same as MyVar nor myvar. It is possible to have multiple distinct variables with the same name but different casing. It is strongly recommended that for the sake of clarity, you do not use this language feature.", "

Best Practice

", "Write variable names in Javascript in camelCase. In camelCase, multi-word variable names have the first word in lowercase and the first letter of each subsequent word is capitalized.", "Examples:", @@ -465,9 +465,9 @@ "id": "cf1391c1c11feddfaeb4bdef", "title": "Create Decimal Numbers with JavaScript", "description": [ - "We can store decimal numbers in variables too. Decimal numbers are sometimes refered to as floating point numbers or floats. ", + "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.", + "Not all real numbers can accurately be represented in floating point. This can lead to rounding errors. Details Here.", "

Instructions

", "Create a variable myDecimal and give it a decimal value." ], @@ -548,14 +548,14 @@ "id": "56533eb9ac21ba0edf2244ae", "title": "Finding a Remainder in Javascript", "description": [ - "The remainder 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 mathematics, a number can be checked even or odd by checking the remainder of the division of the number by 2. ", + "In mathematics, a number can be checked even or odd by checking the remainder of the 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.", + "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 remainder (%) operator." ], @@ -771,9 +771,9 @@ "id": "56533eb9ac21ba0edf2244b3", "title": "Convert Celsius to Fahrenheit", "description": [ - "To test your learning you will create a solution \"from scratch\". Place your code between the indicated lines and it will be tested against multiple test cases.", + "To test your learning you will create a solution \"from scratch\". Place your code between the indicated lines and it will be tested against multiple test cases.", "The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.", - "You are given a variable celsius representing a temperature in Celsius. Create a variable fahrenheit and apply the algorithm to assign it the corresponding temperature in Fahrenheit." + "You are given a variable celsius representing a temperature in Celsius. Create a variable fahrenheit and apply the algorithm to assign it the corresponding temperature in Fahrenheit." ], "releasedOn": "January 1, 2016", "challengeSeed": [ @@ -848,7 +848,7 @@ "id": "56533eb9ac21ba0edf2244b5", "title": "Escaping Literal Quotes in Strings", "description": [ - "When you are defining a string you must start and end with a single or double quote. What happens when you need a literal quote: \" or ' inside of your string?", + "When you are defining a string you must start and end with a single or double quote. What happens when you need a literal quote: \" or ' inside of your string?", "In JavaScript, you can escape a quote from considering it as an end of string quote by placing a backslash (\\) in front of the quote.", "\"Alan said, \\\"Peter is learning JavaScript\\\".\"", "This signals JavaScript that the following quote is not the end of the string, but should instead appear inside the string.", @@ -889,9 +889,9 @@ "id": "56533eb9ac21ba0edf2244b4", "title": "Quoting Strings with Single Quotes", "description": [ - "String values in JavaScript may be written with single or double quotes, so long as you start and end with the same type of quote. Unlike some languages, single and double quotes are functionally identical in Javascript.", + "String values in JavaScript may be written with single or double quotes, so long as you start and end with the same type of quote. Unlike some languages, single and double quotes are functionally identical in Javascript.", "\"This string has \\\"double quotes\\\" in it\"", - "The value in using one or the other has to do with the need to escape quotes of the same type. If you have a string with many double quotes, this can be difficult to read and write. Instead, use single quotes:", + "The value in using one or the other has to do with the need to escape quotes of the same type. If you have a string with many double quotes, this can be difficult to read and write. Instead, use single quotes:", "'This string has \"double quotes\" in it. And \"probably\" lots of them.'", "

Instructions

", "Change the provided string from double to single quotes and remove the escaping." @@ -925,7 +925,7 @@ "id": "56533eb9ac21ba0edf2244b6", "title": "Escape Sequences in Strings", "description": [ - "Quotes are not the only characters that can be escaped inside a string. Here is a table of common escape sequences:", + "Quotes are not the only characters that can be escaped inside a string. Here is a table of common escape sequences:", "
CodeOutput
\\'single quote
\\\"double quote
\\\\backslash
\\nnew line
\\rcarriage return
\\ttab
\\bbackspace
\\fform feed
", "Note that the backslash itself must be escaped in order to display as a backslash.", "

Instructions

", @@ -958,7 +958,7 @@ "In JavaScript, when the + operator is used with a String value, it is called the concatenation operator. You can build a new string out of other strings by concatenating them together.", "Example", "
'My name is Alan,' + ' I concatenate.'
", - "Note
Watch out for spaces. Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself.", + "Note
Watch out for spaces. Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself.", "

Instructions

", "Build myStr from the strings \"This is the start. \" and \"This is the end.\" using the + operator." ], @@ -1002,7 +1002,7 @@ "title": "Concatenating Strings with the Plus Equals Operator", "description": [ "We can also use the += operator to concatenate a string onto the end of an existing string variable. This can be very helpful to break a long string over several lines.", - "Note
Watch out for spaces. Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself.", + "Note
Watch out for spaces. Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself.", "

Instructions

", "Build myStr over several lines by concatenating these two strings:
\"This is the first sentence. \" and \"This is the second sentence.\" using the += operator." ], @@ -1190,7 +1190,7 @@ "title": "Use Bracket Notation to Find the First Character in a String", "description": [ "Bracket notation is a way to get a character at a specific index within a string.", - "Computers don't start counting at 1 like humans do. They start at 0. This is refered to as Zero-based indexing.", + "Computers don't start counting at 1 like humans do. They start at 0. This is refered to as Zero-based indexing.", "For example, the character at index 0 in the word \"Charles\" is \"C\". So if var firstName = \"Charles\", you can get the value of the first letter of the string by using firstName[0].", "

Instructions

", "Use bracket notation to find the first character in the lastName variable and assign it to firstLetterOfLastName.", @@ -1379,8 +1379,8 @@ "id": "56533eb9ac21ba0edf2244bb", "title": "Word Blanks", "description": [ - "We will now use our knowledge of strings to build a \"Mad Libs\" style word game we're calling \"Word Blanks\". You will create an (optionally humorous) \"Fill in the Blanks\" style sentence. ", - "You will need to use string operators to build a new string, result, using the provided variables: myNoun, myAdjective, myVerb, and myAdverb. ", + "We will now use our knowledge of strings to build a \"Mad Libs\" style word game we're calling \"Word Blanks\". You will create an (optionally humorous) \"Fill in the Blanks\" style sentence.", + "You will need to use string operators to build a new string, result, using the provided variables: myNoun, myAdjective, myVerb, and myAdverb.", "You will also need to provide additional strings, which will not change, in between the provided words.", "We have provided a framework for testing your results with different words. The tests will run your function with several different inputs to make sure all of the provided words appear in the output, as well as your extra strings." ], @@ -1484,7 +1484,7 @@ "title": "Access Array Data with Indexes", "description": [ "We can access the data inside arrays using indexes.", - "Array indexes are written in the same bracket notation that strings use, except that instead of specifying a character, they are specifying an entry in the array. Like strings, arrays use zero-based indexing, so the first element in an array is element 0.", + "Array indexes are written in the same bracket notation that strings use, except that instead of specifying a character, they are specifying an entry in the array. Like strings, arrays use zero-based indexing, so the first element in an array is element 0.", "Example", "
var array = [1,2,3];
array[0]; // equals 1
var data = array[1]; // equals 2
", "

Instructions

", @@ -1731,7 +1731,7 @@ "id": "56533eb9ac21ba0edf2244bc", "title": "Shopping List", "description": [ - "Create a shopping list in the variable myList. The list should be a multi-dimensional array containing several sub-arrays. ", + "Create a shopping list in the variable myList. The list should be a multi-dimensional array containing several sub-arrays.", "The first element in each sub-array should contain a string with the name of the item. The second element should be a number representing the quantity i.e.", "[\"Chocolate Bar\", 15]", "There should be at least 5 sub-arrays in the list." @@ -1846,12 +1846,12 @@ "id": "56533eb9ac21ba0edf2244bd", "title": "Passing Values to Functions with Arguments", "description": [ - "Functions can take input with parameters. Parameters are local variables that take on the value of the arguments which are passed into the function. ", + "Functions can take input with parameters. Parameters are local variables that take on the value of the arguments which are passed into the function.", "Here is a function with two parameters, param1 and param2:", "
function testFun(param1, param2) {
console.log(param1, param2);
}
", "Then we can call testFun:", "testFun(\"Hello\", \"World\");", - "We have passed two arguments, \"Hello\" and \"World\". Inside the function, param1 will equal \"Hello\" and param2 will equal \"World\". Note that you could call testFun again with different arguments and the parameters would take on the value of the new arguments.", + "We have passed two arguments, \"Hello\" and \"World\". Inside the function, param1 will equal \"Hello\" and param2 will equal \"World\". Note that you could call testFun again with different arguments and the parameters would take on the value of the new arguments.", "

Instructions

", "
  1. Create a function called myFunction that accepts two arguments and outputs their sum to the dev console.
  2. Call the function.
" ], @@ -1985,7 +1985,7 @@ "id": "56533eb9ac21ba0edf2244bf", "title": "Local Scope and Functions", "description": [ - "Variables which are declared within a function, as well as the function parameters have local scope. That means, they are only visible within that function. ", + "Variables which are declared within a function, as well as the function parameters have local scope. That means, they are only visible within that function.", "Here is a function myTest with a local variable called loc.", "
function myTest() {
var loc = \"foo\";
console.log(loc);
}
myTest(); // \"foo\"
console.log(loc); // \"undefined\"
", "loc is not defined outside of the function.", @@ -2071,7 +2071,7 @@ "id": "56533eb9ac21ba0edf2244c2", "title": "Return a Value from a Function with Return", "description": [ - "We can pass values into a function with arguments. You can use a return statement to send a value back out of a function.", + "We can pass values into a function with arguments. You can use a return statement to send a value back out of a function.", "Example", "
function plusThree(num) {
return num + 3;
}
var answer = plusThree(5); // 8
", "plusThree takes an argument for num and returns a value equal to num + 3.", @@ -2113,7 +2113,7 @@ "id": "56533eb9ac21ba0edf2244c3", "title": "Assignment with a Returned Value", "description": [ - "If you'll recall from our discussion of Storing Values with the Equal Operator, everything to the right of the equal sign is resolved before the value is assigned. This means we can take the return value of a function and assign it to a variable.", + "If you'll recall from our discussion of Storing Values with the Equal Operator, everything to the right of the equal sign is resolved before the value is assigned. This means we can take the return value of a function and assign it to a variable.", "Assume we have pre-defined a function sum which adds two numbers together, then: ", "var ourSum = sum(5, 12);", "will call sum function, which returns a value of 17 and assigns it to ourSum variable.", @@ -2156,7 +2156,7 @@ "title": "Stand in Line", "description": [ "In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue.", - "Write a function queue which takes an \"array\" and an \"item\" as arguments. Add the item onto the end of the array, then remove the first element of the array. The queue function should return the element that was removed." + "Write a function queue which takes an \"array\" and an \"item\" as arguments. Add the item onto the end of the array, then remove the first element of the array. The queue function should return the element that was removed." ], "releasedOn": "January 1, 2016", "head": [ @@ -2216,12 +2216,12 @@ "title": "Use Conditional Logic with If Statements", "description": [ "We can use if statements in JavaScript to execute code only if the specified condition is met.", - "Each if statement requires a boolean condition to evaluate. If the boolean evaluates to true, the statements inside the curly braces will execute. Otherwise, if it evaluates to false, the code will not execute.", + "Each if statement requires a boolean condition to evaluate. If the boolean evaluates to true, the statements inside the curly braces will execute. Otherwise, if it evaluates to false, the code will not execute.", "Example", "
function test(myVal) {
if (myVal > 10) {
return \"Greater Than\";
}
return \"Not Greater Than\";
}
", - "If myVal is greater than 10, the function will return \"Greater Than\". If it is not, the function will return \"Not Greater Than\".", + "If myVal is greater than 10, the function will return \"Greater Than\". If it is not, the function will return \"Not Greater Than\".", "

Instructions

", - "Create an if statement inside the function to return \"Yes\" if testMe is greater than 5. Return \"No\" if it is less than or equal to 5." + "Create an if statement inside the function to return \"Yes\" if testMe is greater than 5. Return \"No\" if it is less than or equal to 5." ], "challengeSeed": [ "// Example", @@ -2267,7 +2267,7 @@ "There are many Comparison Operators in JavaScript. All of these operators return a boolean true or false value.", "The most basic operator is the equality operator ==. The equality operator compares two values and returns true if they're equivalent or false if they are not. Note that equality is different from assignment (=), which assigns the value at the right of the operator to a variable in the left.", "
function equalityTest(myVal) {
if (myVal == 10) {
return \"Equal\";
}
return \"Not Equal\";
}
", - "If myVal is equal to 10, the function will return \"Equal\". If it is not, the function will return \"Not Equal\".", + "If myVal is equal to 10, the function will return \"Equal\". If it is not, the function will return \"Not Equal\".", "The equality operator will do its best to convert values for comparison, for example:", "
1 == 1 // true
\"1\" == 1 // true
1 == '1' // true
0 == false // true
0 == null // false
0 == undefined // false
null == undefined // true
", "

Instructions

", @@ -2307,7 +2307,7 @@ "id": "56533eb9ac21ba0edf2244d1", "title": "Comparison with the Strict Equality Operator", "description": [ - "Strict equality (===) is the counterpart to the equality operator (==). Unlike the equality operator, strict equality tests both the type and value of the compared elements.", + "Strict equality (===) is the counterpart to the equality operator (==). Unlike the equality operator, strict equality tests both the type and value of the compared elements.", "Examples", "
3 === 3 // true
3 === '3' // false
", "In the second example, 3 is a Number type and '3' is a String type.", @@ -2348,7 +2348,7 @@ "id": "56533eb9ac21ba0edf2244d2", "title": "Comparison with the Inequality Operator", "description": [ - "The inequality operator (!=) is the opposite of the equality operator. It means \"Not Equal\" and returns false where equality would return true and vice versa. Like the equality operator, the inequality operator will convert data types of values while comparing.", + "The inequality operator (!=) is the opposite of the equality operator. It means \"Not Equal\" and returns false where equality would return true and vice versa. Like the equality operator, the inequality operator will convert data types of values while comparing.", "Examples", "
1 != 2 // true
1 != \"1\" // false
1 != '1' // false
1 != true // false
0 != false // false
", "

Instructions

", @@ -2532,7 +2532,7 @@ "id": "56533eb9ac21ba0edf2244d6", "title": "Comparison with the Less Than Operator", "description": [ - "The less than operator (<) compares the values of two numbers. If the number to the left is less than the number to the right, it returns true. Otherwise, it returns false. Like the equality operator, less than operator converts data types while comparing.", + "The less than operator (<) compares the values of two numbers. If the number to the left is less than the number to the right, it returns true. Otherwise, it returns false. Like the equality operator, less than operator converts data types while comparing.", "Examples", "
2 < 5 // true
'3' < 7 // true
5 < 5 // false
3 < 2 // false
'8' < 4 // false
", "

Instructions

", @@ -2579,7 +2579,7 @@ "id": "56533eb9ac21ba0edf2244d7", "title": "Comparison with the Less Than Equal To Operator", "description": [ - "The less than equal to operator (<=) compares the values of two numbers. If the number to the left is less than or equal the number to the right, it returns true. If the number on the left is greater than the number on the right, it returns false. Like the equality operator, less than equal to converts data types.", + "The less than equal to operator (<=) compares the values of two numbers. If the number to the left is less than or equal the number to the right, it returns true. If the number on the left is greater than the number on the right, it returns false. Like the equality operator, less than equal to converts data types.", "Examples", "
4 <= 5 // true
'7' <= 7 // true
5 <= 5 // true
3 <= 2 // false
'8' <= 4 // false
", "

Instructions

", @@ -2628,13 +2628,13 @@ "id": "56533eb9ac21ba0edf2244d8", "title": "Comparisons with the Logical And Operator", "description": [ - "Sometimes you will need to test more than one thing at a time. The logical and operator (&&) returns true if and only if the operands to the left and right of it are true.", + "Sometimes you will need to test more than one thing at a time. The logical and operator (&&) returns true if and only if the operands to the left and right of it are true.", "The same effect could be achieved by nesting an if statement inside another if:", "
if (num > 5) {
if (num < 10) {
return \"Yes\";
}
}
return \"No\";
", "will only return \"Yes\" if num is between 6 and 9 (6 and 9 included). The same logic can be written as:", "
if (num > 5 && num < 10) {
return \"Yes\";
}
return \"No\";
", "

Instructions

", - "Combine the two if statements into one statement which will return \"Yes\" if val is less than or equal to 50 and greater than or equal to 25. Otherwise, will return \"No\"." + "Combine the two if statements into one statement which will return \"Yes\" if val is less than or equal to 50 and greater than or equal to 25. Otherwise, will return \"No\"." ], "releasedOn": "January 1, 2016", "challengeSeed": [ @@ -2687,7 +2687,7 @@ "will return \"Yes\" only if num is between 5 and 10 (5 and 10 included). The same logic can be written as:", "
if (num > 10 || num < 5) {
return \"No\";
}
return \"Yes\";
", "

Instructions

", - "Combine the two if statements into one statement which returns \"Outside\" if val is not between 10 and 20, inclusive. Otherwise, return \"Inside\"." + "Combine the two if statements into one statement which returns \"Outside\" if val is not between 10 and 20, inclusive. Otherwise, return \"Inside\"." ], "releasedOn": "January 1, 2016", "challengeSeed": [ @@ -2736,7 +2736,7 @@ "id": "56533eb9ac21ba0edf2244da", "title": "Introducing Else Statements", "description": [ - "When a condition for an if statement is true, the block of code following it is executed. What about when that condition is false? Normally nothing would happen. With an else statement, an alternate block of code can be executed.", + "When a condition for an if statement is true, the block of code following it is executed. What about when that condition is false? Normally nothing would happen. With an else statement, an alternate block of code can be executed.", "
if (num > 10) {
return \"Bigger than 10\";
} else {
return \"10 or Less\";
}
", "

Instructions

", "Combine the if statements into a single statement." @@ -2929,10 +2929,10 @@ "id": "56533eb9ac21ba0edf2244dd", "title": "Selecting from many options with Switch Statements", "description": [ - "If you have many options to choose from, use a switch statement. A switch statement tests a value and can have many case statements which defines various possible values. Statements are executed from the first matched case value until a break is encountered. ", + "If you have many options to choose from, use a switch statement. A switch statement tests a value and can have many case statements which defines various possible values. Statements are executed from the first matched case value until a break is encountered.", "Here is a pseudocode example:", "
switch (num) {
case value1:
statement1;
break;
case value2:
statement2;
break;
...
case valueN:
statementN;
break;
}
", - "case values are tested with strict equality (===). The break tells JavaScript to stop executing statements. If the break is omitted, the next statement will be executed.", + "case values are tested with strict equality (===). The break tells JavaScript to stop executing statements. If the break is omitted, the next statement will be executed.", "

Instructions

", "Write a switch statement which tests val and sets answer for the following conditions:
1 - \"alpha\"
2 - \"beta\"
3 - \"gamma\"
4 - \"delta\"" ], @@ -3021,7 +3021,7 @@ "id": "56533eb9ac21ba0edf2244df", "title": "Multiple Identical Options in Switch Statements", "description": [ - "If the break statement is ommitted from a switch statement's case, the following case statement(s) are executed until a break is encountered. If you have multiple inputs with the same output, you can represent them in a switch statement like this:", + "If the break statement is ommitted from a switch statement's case, the following case statement(s) are executed until a break is encountered. If you have multiple inputs with the same output, you can represent them in a switch statement like this:", "
switch(val) {
case 1:
case 2:
case 3:
result = \"1, 2, or 3\";
break;
case 4:
result = \"4 alone\";
}
", "Cases for 1, 2, and 3 will all produce the same result.", "

Instructions

", @@ -3073,7 +3073,7 @@ "id": "56533eb9ac21ba0edf2244e0", "title": "Replacing If Else Chains with Switch", "description": [ - "If you have many options to choose from, a switch statement can be easier to write than many chained if/if else statements. The following:", + "If you have many options to choose from, a switch statement can be easier to write than many chained if/if else statements. The following:", "
if(val === 1) {
answer = \"a\";
} else if(val === 2) {
answer = \"b\";
} else {
answer = \"c\";
}
", "can be replaced with:", "
switch (val) {
case 1:
answer = \"a\";
break;
case 2:
answer = \"b\";
break;
default:
answer = \"c\";
}
", @@ -3227,10 +3227,10 @@ "id": "565bbe00e9cc8ac0725390f4", "title": "Counting Cards", "description": [ - "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. ", + "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 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 is 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 is positive, or \"Hold\" if the count is zero or negative.", "Example Output", "-3 Hold
5 Bet" ], @@ -3246,7 +3246,7 @@ " // Only change code above this line", "}", "", - "// Add/remove calls to test your function. ", + "// Add/remove calls to test your function.", "// Note: Only the last will display", "cc(2); cc(3); cc(7); cc('K'); cc('A');" ], @@ -3364,7 +3364,7 @@ "id": "56533eb9ac21ba0edf2244c8", "title": "Accessing Objects Properties with Bracket Notation", "description": [ - "The second way to access the properties of an object is bracket notation ([]). If the property of the object you are trying to access has a space in it, you will need to use bracket notation.", + "The second way to access the properties of an object is bracket notation ([]). If the property of the object you are trying to access has a space in it, you will need to use bracket notation.", "Here is a sample of using bracket notation to read an object property:", "
var myObj = {
\"Space Name\": \"Kirk\",
\"More Space\": \"Spock\"
};
myObj[\"Space Name\"]; // Kirk
myObj['More Space']; // Spock
", "Note that property names with spaces in them must be in quotes (single or double).", @@ -3455,7 +3455,7 @@ "id": "bg9999c9c99feddfaeb9bdef", "title": "Updating Object Properties", "description": [ - "After you've created a JavaScript object, you can update its properties at any time just like you would update any other variable. You can use either dot or bracket notation to update.", + "After you've created a JavaScript object, you can update its properties at any time just like you would update any other variable. You can use either dot or bracket notation to update.", "For example, let's look at ourDog:", "
var ourDog = {
\"name\": \"Camper\",
\"legs\": 4,
\"tails\": 1,
\"friends\": [\"everything!\"]
};
", "Since he's a particularly happy dog, let's change his name to \"Happy Camper\". Here's how we update his object's name property:", @@ -3463,7 +3463,7 @@ "ourDog[\"name\"] = \"Happy Camper\";", "Now when we evaluate ourDog.name, instead of getting \"Camper\", we'll get his new name, \"Happy Camper\".", "

Instructions

", - "Update the myDog object's name property. Let's change her name from \"Coder\" to \"Happy Coder\". You can use either dot or bracket notation." + "Update the myDog object's name property. Let's change her name from \"Coder\" to \"Happy Coder\". You can use either dot or bracket notation." ], "challengeSeed": [ "// Example", @@ -3505,7 +3505,7 @@ "id": "bg9999c9c99feedfaeb9bdef", "title": "Add New Properties to a JavaScript Object", "description": [ - "You can add new properties to existing JavaScript objects the same way you would modify them. ", + "You can add new properties to existing JavaScript objects the same way you would modify them.", "Here's how we would add a \"bark\" property to ourDog:", "ourDog.bark = \"bow-wow\"; ", "or", @@ -3604,7 +3604,7 @@ "Here is an example of a simple reverse alphabet lookup:", "
var alpha = {
1:\"Z\",
2:\"Y\",
3:\"X\",
4:\"W\",
...
24:\"C\",
25:\"B\",
26:\"A\"
};
alpha[2]; // \"Y\"
alpha[24]; // \"C\"
", "

Instructions

", - "Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string." + "Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string." ], "releasedOn": "January 1, 2016", "challengeSeed": [ @@ -3665,11 +3665,11 @@ "id": "567af2437cbaa8c51670a16c", "title": "Testing Objects for Properties", "description": [ - "Sometimes it is useful to check if the property of a given object exists or not. We can use the .hasOwnProperty([propname]) method of objects to determine if that object has the given property name. .hasOwnProperty() returns true or false if the property is found or not.", + "Sometimes it is useful to check if the property of a given object exists or not. We can use the .hasOwnProperty([propname]) method of objects to determine if that object has the given property name. .hasOwnProperty() returns true or false if the property is found or not.", "Example", "
var myObj = {
top: \"hat\",
bottom: \"pants\"
};
myObj.hasOwnProperty(\"top\"); // true
myObj.hasOwnProperty(\"middle\"); // false
", "

Instructions

", - "Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return \"Not Found\"." + "Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return \"Not Found\"." ], "releasedOn": "January 1, 2016", "challengeSeed": [ @@ -3764,7 +3764,7 @@ "Here is a nested JSON Object:", "
var ourStorage = {
\"desk\": {
\"drawer\": \"stapler\"
},
\"cabinet\": {
\"top drawer\": {
\"folder1\": \"a file\",
\"folder2\": \"secrets\"
},
\"bottom drawer\": \"soda\"
}
}
ourStorage.cabinet[\"top drawer\"].folder2; // \"secrets\"
ourStorage.desk.drawer; // \"stapler\"
", "

Instructions

", - "Access the myStorage JSON object to retrieve the contents of the glove box. Only use object notation for properties with a space in their name." + "Access the myStorage JSON object to retrieve the contents of the glove box. Only use object notation for properties with a space in their name." ], "releasedOn": "January 1, 2016", "challengeSeed": [ @@ -3813,7 +3813,7 @@ "id": "56533eb9ac21ba0edf2244cd", "title": "Accessing Nested Arrays in JSON", "description": [ - "As we have seen in earlier examples, JSON objects can contain both nested objects and nested arrays. Similar to accessing nested objects, Array bracket notation can be chained to access nested arrays.", + "As we have seen in earlier examples, JSON objects can contain both nested objects and nested arrays. Similar to accessing nested objects, Array bracket notation can be chained to access nested arrays.", "Here is an example of how to access a nested array:", "
var ourPets = {
\"cats\": [
\"Meowzer\",
\"Fluffy\",
\"Kit-Cat\"
],
\"dogs:\" [
\"Spot\",
\"Bowser\",
\"Frankie\"
]
};
ourPets.cats[1]; // \"Fluffy\"
ourPets.dogs[0]; // \"Spot\"
", "

Instructions

", @@ -3873,7 +3873,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 unique id number and 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 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.", @@ -3952,9 +3952,9 @@ "For loops are declared with three optional expressions seperated by semicolons:", "for ([initialization]; [condition]; [final-expression])", "The initialization statement is executed one time only before the loop starts. It is typically used to define and setup your loop variable.", - "The condition statement is evaluated at the beginning of every loop iteration and will continue as long as it evalutes to true. When condition is false at the start of the iteration, the loop will stop executing. This means if condition starts as false, your loop will never execute.", + "The condition statement is evaluated at the beginning of every loop iteration and will continue as long as it evalutes to true. When condition is false at the start of the iteration, the loop will stop executing. This means if condition starts as false, your loop will never execute.", "The final-expression is executed at the end of each loop iteration, prior to the next condition check and is usually used to increment or decrement your loop counter.", - "In the following example we initialize with i = 0 and iterate while our condition i < 5 is true. We'll increment i by 1 in each loop iteration with i++ as our final-expression.", + "In the following example we initialize with i = 0 and iterate while our condition i < 5 is true. We'll increment i by 1 in each loop iteration with i++ as our final-expression.", "
var ourArray = [];
for (var i = 0; i < 5; i++) {
ourArray.push(i);
}
", "ourArray will now contain [0,1,2,3,4].", "

Instructions

", @@ -3993,7 +3993,7 @@ "title": "Iterate Odd Numbers With a For Loop", "description": [ "For loops don't have to iterate one at a time. By changing our final-expression, we can count by even numbers.", - "We'll start at i = 0 and loop while i < 10. We'll increment i by 2 each loop with i += 2.", + "We'll start at i = 0 and loop while i < 10. We'll increment i by 2 each loop with i += 2.", "
var ourArray = [];
for (var i = 0; i < 10; i += 2) {
ourArray.push(i);
}
", "ourArray will now contain [0,2,4,6,8].", "Let's change our initialization so we can count by odd numbers.", @@ -4034,7 +4034,7 @@ "description": [ "A for loop can also count backwards, so long as we can define the right conditions.", "In order to count backwards by twos, we'll need to change our initialization, condition, and final-expression.", - "We'll start at i = 10 and loop while i > 0. We'll decrement i by 2 each loop with i -= 2.", + "We'll start at i = 10 and loop while i > 0. We'll decrement i by 2 each loop with i -= 2.", "
var ourArray = [];
for (var i=10; i > 0; i-=2) {
ourArray.push(i);
}
", "ourArray will now contain [10,8,6,4,2].", "Let's change our initialization and final-expression so we can count backward by twos by odd numbers.", @@ -4072,9 +4072,9 @@ "id": "5675e877dbd60be8ad28edc6", "title": "Iterate Through an Array with a For Loop", "description": [ - "A common task in Javascript is to iterate through the contents of an array. One way to do that is with a for loop. This code will output each element of the array arr to the console:", + "A common task in Javascript is to iterate through the contents of an array. One way to do that is with a for loop. This code will output each element of the array arr to the console:", "
var arr = [10,9,8,7,6];
for (var i=0; i < arr.length; i++) {
console.log(arr[i]);
}
", - "Remember that Arrays have zero-based numbering, which means the last index of the array is length - 1. Our condition for this loop is i < arr.length, which stops when i is at length - 1.", + "Remember that Arrays have zero-based numbering, which means the last index of the array is length - 1. Our condition for this loop is i < arr.length, which stops when i is at length - 1.", "

Instructions

", "Declare and initialize a variable total to 0. Use a for loop to add the value of each element of the myArr array to total." ], @@ -4118,7 +4118,7 @@ "id": "56533eb9ac21ba0edf2244e1", "title": "Nesting For Loops", "description": [ - "If you have a multi-dimensional array, you can use the same logic as the prior waypoint to loop through both the array and any sub-arrays. Here is an example:", + "If you have a multi-dimensional array, you can use the same logic as the prior waypoint to loop through both the array and any sub-arrays. Here is an example:", "
var arr = [
[1,2], [3,4], [5,6]
];
for (var i=0; i < arr.length; i++) {
for (var j=0; j < arr[i].length; j++) {
console.log(arr[i][j]);
}
}
", "This outputs each sub-element in arr one at a time. Note that for the inner loop, we are checking the .length of arr[i], since arr[i] is itself an array.", "

Instructions

", @@ -4193,9 +4193,9 @@ "id": "56533eb9ac21ba0edf2244e2", "title": "Caesar's Cipher", "description": [ - "One of the simplest and most widely known ciphers is a Caesar cipher, also known as a shift cipher. In a shift cipher the meanings of the letters are shifted by some set amount. ", - "A common modern use is the ROT13 cipher, where the values of the letters are shifted by 13 places. Thus 'A' ↔ 'N', 'B' ↔ 'O' and so on.", - "Write a function which takes a ROT13 encoded string as input and returns a decoded string. All letters will be uppercase. Do not transform any non-alphabetic character (i.e. spaces, punctuation), but do pass them on.", + "One of the simplest and most widely known ciphers is a Caesar cipher, also known as a shift cipher. In a shift cipher the meanings of the letters are shifted by some set amount.", + "A common modern use is the ROT13 cipher, where the values of the letters are shifted by 13 places. Thus 'A' ↔ 'N', 'B' ↔ 'O' and so on.", + "Write a function which takes a ROT13 encoded string as input and returns a decoded string. All letters will be uppercase. Do not transform any non-alphabetic character (i.e. spaces, punctuation), but do pass them on.", "The provided code transforms the input into an array for you, codeArr. Place the decoded values into the decodedArr array where the provided code will transform it back into a string." ], "releasedOn": "January 1, 2016", @@ -4239,7 +4239,7 @@ "title": "Generate Random Fractions with JavaScript", "description": [ "Random numbers are useful for creating random behavior.", - "JavaScript has a Math.random() function that generates a random decimal number between 0 (inclusive) and not quite up to 1 (exclusive). Thus Math.random() can return a 0 but never quite return a 1", + "JavaScript has a Math.random() function that generates a random decimal number between 0 (inclusive) and not quite up to 1 (exclusive). Thus Math.random() can return a 0 but never quite return a 1", "Note", "Like Storing Values with the Equal Operator, all function calls will be resolved before the return executes, so we can simply return the value of the Math.random() function.", "

Instructions

", @@ -4273,7 +4273,7 @@ "id": "cf1111c1c12feddfaeb1bdef", "title": "Generate Random Whole Numbers with JavaScript", "description": [ - "It's great that we can generate random decimal numbers, but it's even more useful if we use it to generate random whole numbers.
  1. Use Math.random() to generate a random decimal.
  2. Multiply that random decimal by 20.
  3. Use another function, Math.floor() to round the number down to its nearest whole number.
Remember that Math.random() can never quite return a 1 and, because we're rounding down, it's impossible to actually get 20. This technique will gives us a whole number between 0 and 19.", + "It's great that we can generate random decimal numbers, but it's even more useful if we use it to generate random whole numbers.
  1. Use Math.random() to generate a random decimal.
  2. Multiply that random decimal by 20.
  3. Use another function, Math.floor() to round the number down to its nearest whole number.
Remember that Math.random() can never quite return a 1 and, because we're rounding down, it's impossible to actually get 20. This technique will gives us a whole number between 0 and 19.", "Putting everything together, this is what our code looks like:", "Math.floor(Math.random() * 20);", "See how Math.floor takes (Math.random() * 20) as its argument? That's right - you can pass a function to another function as an argument.",