Merge pull request #4179 from ltegman/fix/typos-and-example-code-style
Fix Typos and Example Code Styling
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
"id": "bd7123c9c441eddfaeb4bdef",
|
"id": "bd7123c9c441eddfaeb4bdef",
|
||||||
"title": "Comment your JavaScript Code",
|
"title": "Comment your JavaScript Code",
|
||||||
"description": [
|
"description": [
|
||||||
"Comments are lines of code that your computer will intentionally ignore. Comments are a great way to leave notes to yourself and to other people who will later need to figure out what it does.",
|
"Comments are lines of code that your computer will intentionally ignore. Comments are a great way to leave notes to yourself and to other people who will later need to figure out what that code does.",
|
||||||
"Let's take a look at the two ways you can write comments in JavaScript.",
|
"Let's take a look at the two ways you can write comments in JavaScript.",
|
||||||
"The double-slash comment will comment out the remainder of the text on the current line:",
|
"The double-slash comment will comment out the remainder of the text on the current line:",
|
||||||
"<code>// This is a comment.</code>",
|
"<code>// This is a comment.</code>",
|
||||||
@ -88,7 +88,6 @@
|
|||||||
"assert((function(){if(typeof(myLastName) !== \"undefined\" && typeof(myLastName) === \"string\" && myLastName.length > 0){return true;}else{return false;}})(), 'message: <code>myLastName</code> should be a string with at least one character in it.');"
|
"assert((function(){if(typeof(myLastName) !== \"undefined\" && typeof(myLastName) === \"string\" && myLastName.length > 0){return true;}else{return false;}})(), 'message: <code>myLastName</code> should be a string with at least one character in it.');"
|
||||||
],
|
],
|
||||||
"challengeSeed": [
|
"challengeSeed": [
|
||||||
"var name = \"Alan Turing\";",
|
|
||||||
"var firstName = \"Alan\";",
|
"var firstName = \"Alan\";",
|
||||||
"var lastName = \"Turing\";",
|
"var lastName = \"Turing\";",
|
||||||
"",
|
"",
|
||||||
@ -141,11 +140,11 @@
|
|||||||
"<code>Bracket notation</code> is a way to get a character at a specific <code>index</code> within a string.",
|
"<code>Bracket notation</code> is a way to get a character at a specific <code>index</code> within a string.",
|
||||||
"Computers don't start counting at 1 like humans do. They start at 0.",
|
"Computers don't start counting at 1 like humans do. They start at 0.",
|
||||||
"For example, the character at index 0 in the word \"Charles\" is \"C\". So if <code>var firstName = \"Charles\"</code>, you can get the value of the first letter of the string by using <code>firstName[0]</code>.",
|
"For example, the character at index 0 in the word \"Charles\" is \"C\". So if <code>var firstName = \"Charles\"</code>, you can get the value of the first letter of the string by using <code>firstName[0]</code>.",
|
||||||
"Use <code>bracket notation</code> to find the first character in the <code>firstLetterOfLastName</code> variable.",
|
"Use <code>bracket notation</code> to find the first character in the <code>lastName</code> variable and assign it to <code>firstLetterOfLastName</code>.",
|
||||||
"Try looking at the <code>firstLetterOfFirstName</code> variable declaration if you get stuck."
|
"Try looking at the <code>firstLetterOfFirstName</code> variable declaration if you get stuck."
|
||||||
],
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
"assert((function(){if(typeof(firstLetterOfLastName) !== \"undefined\" && editor.getValue().match(/\\[0\\]/gi) && typeof(firstLetterOfLastName) === \"string\" && firstLetterOfLastName === \"L\"){return true;}else{return false;}})(), 'message: The first letter of <code>firstLetterOfLastName</code> should be a <code>\"L\"</code>.');"
|
"assert((function(){if(typeof(firstLetterOfLastName) !== \"undefined\" && editor.getValue().match(/\\[0\\]/gi) && typeof(firstLetterOfLastName) === \"string\" && firstLetterOfLastName === \"L\"){return true;}else{return false;}})(), 'message: The <code>firstLetterOfLastName</code> variable should have the value of <code>L</code>.');"
|
||||||
],
|
],
|
||||||
"challengeSeed": [
|
"challengeSeed": [
|
||||||
"var firstLetterOfFirstName = \"\";",
|
"var firstLetterOfFirstName = \"\";",
|
||||||
@ -177,7 +176,7 @@
|
|||||||
"Try looking at the <code>secondLetterOfFirstName</code> variable declaration if you get stuck."
|
"Try looking at the <code>secondLetterOfFirstName</code> variable declaration if you get stuck."
|
||||||
],
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
"assert(thirdLetterOfLastName === 'v', 'message: The third letter of <code>lastName</code> should be a \"v\".');"
|
"assert(thirdLetterOfLastName === 'v', 'message: The <code>thirdLetterOfLastName</code> variable should have the value of <code>v</code>.');"
|
||||||
],
|
],
|
||||||
"challengeSeed": [
|
"challengeSeed": [
|
||||||
"var firstName = \"Ada\";",
|
"var firstName = \"Ada\";",
|
||||||
@ -230,7 +229,7 @@
|
|||||||
"id": "bd7123c9c452eddfaeb5bdef",
|
"id": "bd7123c9c452eddfaeb5bdef",
|
||||||
"title": "Use Bracket Notation to Find the Nth-to-Last Character in a String",
|
"title": "Use Bracket Notation to Find the Nth-to-Last Character in a String",
|
||||||
"description": [
|
"description": [
|
||||||
"In order to get the last letter of a string, you can subtract one from the string's length.",
|
"You can use the same principle we just used to retrieve the last character in a string to retrieve the Nth-to-last character.",
|
||||||
"For example, you can get the value of the third-to-last letter of the <code>var firstName = \"Charles\"</code> string by using <code>firstName[firstName.length - 3]</code>",
|
"For example, you can get the value of the third-to-last letter of the <code>var firstName = \"Charles\"</code> string by using <code>firstName[firstName.length - 3]</code>",
|
||||||
"Use <code>bracket notation</code> to find the second-to-last character in the <code>lastName</code> string.",
|
"Use <code>bracket notation</code> to find the second-to-last character in the <code>lastName</code> string.",
|
||||||
"Try looking at the <code>thirdToLastLetterOfFirstName</code> variable declaration if you get stuck."
|
"Try looking at the <code>thirdToLastLetterOfFirstName</code> variable declaration if you get stuck."
|
||||||
@ -662,7 +661,7 @@
|
|||||||
"Create and call a function called <code>myFunction</code> that returns the sum of <code>a</code> and <code>b</code>."
|
"Create and call a function called <code>myFunction</code> that returns the sum of <code>a</code> and <code>b</code>."
|
||||||
],
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
"assert((function(){if(typeof(f) !== \"undefined\" && f === a + b){return true;}else{return false;}})(), 'message: Your function should return the value of a + b');"
|
"assert((function(){if(typeof(f) !== \"undefined\" && f === a + b){return true;}else{return false;}})(), 'message: Your function should return the value of <code>a + b</code>.');"
|
||||||
],
|
],
|
||||||
"challengeSeed": [
|
"challengeSeed": [
|
||||||
"var a = 4;",
|
"var a = 4;",
|
||||||
@ -772,6 +771,10 @@
|
|||||||
" \"friends\": [\"Free Code Camp Campers\"]",
|
" \"friends\": [\"Free Code Camp Campers\"]",
|
||||||
"};",
|
"};",
|
||||||
"",
|
"",
|
||||||
|
"// Only change code below this line.",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
"// Only change code above this line.",
|
"// Only change code above this line.",
|
||||||
"",
|
"",
|
||||||
"(function(z){return z;})(myDog);"
|
"(function(z){return z;})(myDog);"
|
||||||
@ -878,11 +881,11 @@
|
|||||||
"<code> ourArray.push(i);</code>",
|
"<code> ourArray.push(i);</code>",
|
||||||
"<code>}</code>",
|
"<code>}</code>",
|
||||||
"<code>ourArray</code> will now contain <code>[0,1,2,3,4]</code>.",
|
"<code>ourArray</code> will now contain <code>[0,1,2,3,4]</code>.",
|
||||||
"Let's try getting a <code>for</code> loop to work by pushing values to an array."
|
"Let's use a <code>for</code> loop to work to push the values 1 through 5 onto <code>myArray</code>."
|
||||||
],
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
"assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a <code>for</code> loop for this.');",
|
"assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a <code>for</code> loop for this.');",
|
||||||
"assert.deepEqual(myArray, [0,1,2,3,4], 'message: <code>myArray</code> should equal <code>[0,1,2,3,4]</code>');"
|
"assert.deepEqual(myArray, [1,2,3,4,5], 'message: <code>myArray</code> should equal <code>[1,2,3,4,5]</code>.');"
|
||||||
],
|
],
|
||||||
"challengeSeed": [
|
"challengeSeed": [
|
||||||
"var ourArray = [];",
|
"var ourArray = [];",
|
||||||
@ -915,13 +918,13 @@
|
|||||||
"<code>for (var i = 0; i < 10; i += 2) {</code>",
|
"<code>for (var i = 0; i < 10; i += 2) {</code>",
|
||||||
"<code> ourArray.push(i);</code>",
|
"<code> ourArray.push(i);</code>",
|
||||||
"<code>}</code>",
|
"<code>}</code>",
|
||||||
"<code>ourArray</code> will now contain [0,2,4,6,8] ",
|
"<code>ourArray</code> will now contain <code>[0,2,4,6,8]</code>.",
|
||||||
"Let's change our <code>initialization</code> and <code>final-expression</code> so we can count by odd numbers.",
|
"Let's change our <code>initialization</code> and <code>final-expression</code> so we can count by odd numbers.",
|
||||||
"Push the odd numbers from 1 through 9 to <code>myArray</code> using a <code>for loop</code>."
|
"Push the odd numbers from 1 through 9 to <code>myArray</code> using a <code>for</code> loop."
|
||||||
],
|
],
|
||||||
"tests":[
|
"tests":[
|
||||||
"assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a <code>for</code> loop for this.');",
|
"assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a <code>for</code> loop for this.');",
|
||||||
"assert.deepEqual(myArray, [1,3,5,7,9], 'message: <code>myArray</code> should equal <code>[1,3,5,7,9]</code>');"
|
"assert.deepEqual(myArray, [1,3,5,7,9], 'message: <code>myArray</code> should equal <code>[1,3,5,7,9]</code>.');"
|
||||||
],
|
],
|
||||||
"challengeSeed":[
|
"challengeSeed":[
|
||||||
"var ourArray = [];",
|
"var ourArray = [];",
|
||||||
@ -955,13 +958,13 @@
|
|||||||
"<code>for (var i = 10; i > 0; i -= 2) {</code>",
|
"<code>for (var i = 10; i > 0; i -= 2) {</code>",
|
||||||
"<code> ourArray.push(i);</code>",
|
"<code> ourArray.push(i);</code>",
|
||||||
"<code>}</code>",
|
"<code>}</code>",
|
||||||
"<code>ourArray</code> will now contain <code>[10,8,6,4,2]</code>",
|
"<code>ourArray</code> will now contain <code>[10,8,6,4,2]</code>.",
|
||||||
"Let's change our <code>initialization</code> and <code>final-expression</code> so we can count backward by twos for numbers.",
|
"Let's change our <code>initialization</code> and <code>final-expression</code> so we can count backward by twos for numbers.",
|
||||||
"Push the odd numbers from 9 through 1 to <code>myArray</code> using a <code>for loop</code>."
|
"Push the odd numbers from 9 through 1 to <code>myArray</code> using a <code>for</code> loop."
|
||||||
],
|
],
|
||||||
"tests":[
|
"tests":[
|
||||||
"assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a <code>for</code> loop for this.');",
|
"assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a <code>for</code> loop for this.');",
|
||||||
"assert.deepEqual(myArray, [9,7,5,3,1], 'message: <code>myArray</code> should equal <code>[9,7,5,3,1]</code>');"
|
"assert.deepEqual(myArray, [9,7,5,3,1], 'message: <code>myArray</code> should equal <code>[9,7,5,3,1]</code>.');"
|
||||||
],
|
],
|
||||||
"challengeSeed":[
|
"challengeSeed":[
|
||||||
"var ourArray = [];",
|
"var ourArray = [];",
|
||||||
@ -997,11 +1000,11 @@
|
|||||||
"<code> i++;</code>",
|
"<code> i++;</code>",
|
||||||
"<code>}</code>",
|
"<code>}</code>",
|
||||||
"Let's try getting a while loop to work by pushing values to an array.",
|
"Let's try getting a while loop to work by pushing values to an array.",
|
||||||
"Push the numbers 0 through 4 to <code>myArray</code> using a <code>while loop</code>."
|
"Push the numbers 0 through 4 to <code>myArray</code> using a <code>while</code> loop."
|
||||||
],
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
"assert(editor.getValue().match(/while/g), 'message: You should be using a <code>while</code> loop for this.');",
|
"assert(editor.getValue().match(/while/g), 'message: You should be using a <code>while</code> loop for this.');",
|
||||||
"assert.deepEqual(myArray, [0,1,2,3,4], 'message: <code>myArray</code> should equal <code>[0,1,2,3,4]</code>');"
|
"assert.deepEqual(myArray, [0,1,2,3,4], 'message: <code>myArray</code> should equal <code>[0,1,2,3,4]</code>.');"
|
||||||
],
|
],
|
||||||
"challengeSeed": [
|
"challengeSeed": [
|
||||||
"var myArray = [];",
|
"var myArray = [];",
|
||||||
@ -1093,7 +1096,7 @@
|
|||||||
"To do this, we'll define a minimum number <code>min</code> and a maximum number <code>max</code>.",
|
"To do this, we'll define a minimum number <code>min</code> and a maximum number <code>max</code>.",
|
||||||
"Here's the formula we'll use. Take a moment to read it and try to understand what this code is doing:",
|
"Here's the formula we'll use. Take a moment to read it and try to understand what this code is doing:",
|
||||||
"<code>Math.floor(Math.random() * (max - min + 1)) + min</code>",
|
"<code>Math.floor(Math.random() * (max - min + 1)) + min</code>",
|
||||||
"Define two variables: <code>myMin</code> and </code>myMax</code>, and set them both equal to numbers.",
|
"Define two variables: <code>myMin</code> and <code>myMax</code>, and set them both equal to numbers.",
|
||||||
"Then create a function called <code>myFunction</code> that returns a random number that's greater than or equal to <code>myMin</code>, and is less than or equal to <code>myMax</code>."
|
"Then create a function called <code>myFunction</code> that returns a random number that's greater than or equal to <code>myMin</code>, and is less than or equal to <code>myMax</code>."
|
||||||
],
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
@ -1212,7 +1215,7 @@
|
|||||||
"title": "Find Numbers with Regular Expressions",
|
"title": "Find Numbers with Regular Expressions",
|
||||||
"description": [
|
"description": [
|
||||||
"We can use special selectors in <code>Regular Expressions</code> to select a particular type of value.",
|
"We can use special selectors in <code>Regular Expressions</code> to select a particular type of value.",
|
||||||
"One such selector is the digit selector <code>\\d</code> which is used to grab the numbers in a string.",
|
"One such selector is the digit selector <code>\\d</code> which is used to retrieve the numbers in a string.",
|
||||||
"It is used like this: <code>/\\d/g</code>.",
|
"It is used like this: <code>/\\d/g</code>.",
|
||||||
"For numbers this is often written as <code>/\\d+/g</code>, where the <code>+</code> following the digit selector allows this regular expression to match multi-digit numbers.",
|
"For numbers this is often written as <code>/\\d+/g</code>, where the <code>+</code> following the digit selector allows this regular expression to match multi-digit numbers.",
|
||||||
"Use the <code>\\d</code> selector to select the number of numbers in the string, allowing for the possibility of multi-digit numbers."
|
"Use the <code>\\d</code> selector to select the number of numbers in the string, allowing for the possibility of multi-digit numbers."
|
||||||
|
Reference in New Issue
Block a user