Merge pull request #4114 from ltegman/fix/sidebar-indentation-character

Fix Sidebar Code Indentation Character
This commit is contained in:
Berkeley Martinez
2015-11-01 23:01:58 -08:00
4 changed files with 63 additions and 63 deletions

View File

@@ -653,7 +653,7 @@
"In JavaScript, we can divide up our code into reusable parts called functions.",
"Here's an example of a function:",
"<code>function functionName(a, b) {</code>",
"<code>&thinsp;&thinsp;return a + b;</code>",
"<code>&nbsp;&nbsp;return a + b;</code>",
"<code>}</code>",
"After writing the above lines in our code, we can then pass values to our function and the result following the <code>return</code> statement will be returned.",
"For example, we can pass numbers <code>4</code> and <code>2</code> by “calling” the function later in our code like this: <code>functionName(4, 2)</code>.",
@@ -694,10 +694,10 @@
"Objects are similar to <code>arrays</code>, except that instead of using indexes to access and modify their data, you access the data in objects through what are called <code>properties</code>.",
"Here's a sample object:",
"<code>var cat = {</code>",
"<code>&thinsp;&thinsp;\"name\": \"Whiskers\",</code>",
"<code>&thinsp;&thinsp;\"legs\": 4,</code>",
"<code>&thinsp;&thinsp;\"tails\": 1,</code>",
"<code>&thinsp;&thinsp;\"enemies\": [\"Water\", \"Dogs\"]</code>",
"<code>&nbsp;&nbsp;\"name\": \"Whiskers\",</code>",
"<code>&nbsp;&nbsp;\"legs\": 4,</code>",
"<code>&nbsp;&nbsp;\"tails\": 1,</code>",
"<code>&nbsp;&nbsp;\"enemies\": [\"Water\", \"Dogs\"]</code>",
"<code>};</code>",
"</code>",
"Objects are useful for storing data in a structured way, and can represent real world objects, like a cat.",
@@ -741,10 +741,10 @@
"After you've created a JavaScript object, you can update its properties at any time just like you would update any other variable.",
"For example, let's look at <code>ourDog</code>:",
"<code>var ourDog = {</code>",
"<code>&thinsp;&thinsp;\"name\": \"Camper\",</code>",
"<code>&thinsp;&thinsp;\"legs\": 4,</code>",
"<code>&thinsp;&thinsp;\"tails\": 1,</code>,",
"<code>&thinsp;&thinsp;\"friends\": [\"everything!\"]</code>",
"<code>&nbsp;&nbsp;\"name\": \"Camper\",</code>",
"<code>&nbsp;&nbsp;\"legs\": 4,</code>",
"<code>&nbsp;&nbsp;\"tails\": 1,</code>,",
"<code>&nbsp;&nbsp;\"friends\": [\"everything!\"]</code>",
"<code>};</code>",
"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:",
"<code>ourDog.name = \"Happy Camper\";</code>",
@@ -874,7 +874,7 @@
"In the following example we initialize with <code>i = 0</code> and iterate while our condition <code>i < 5</code> is true. We'll increment <code>i</code> by <code>1</code> in each loop iteration with <code>i++</code> as our <code>final-expression</code>.",
"<code>var ourArray = [];</code>",
"<code>for(var i = 0; i < 5; i++) {</code>",
"<code>&thinsp;&thinsp;ourArray.push(i);</code>",
"<code>&nbsp;&nbsp;ourArray.push(i);</code>",
"<code>}</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."
@@ -912,7 +912,7 @@
"We'll start at <code>i = 0</code> and loop while <code>i < 10</code>. We'll increment <code>i</code> by 2 each loop with <code>i += 2</code>.",
"<code>var ourArray = [];</code>",
"<code>for(var i = 0; i < 10; i += 2) {</code>",
"<code>&thinsp;&thinsp;ourArray.push(i);</code>",
"<code>&nbsp;&nbsp;ourArray.push(i);</code>",
"<code>}</code>",
"<code>ourArray</code> will now contain [0,2,4,6,8] ",
"Let's change our <code>initialization</code> and <code>final-expression</code> so we can count by odd numbers.",
@@ -952,7 +952,7 @@
"We'll start at <code>i = 10</code> and loop while <code>i > 0</code>. We'll decrement <code>i</code> by 2 each loop with <code>i -= 2</code>.",
"<code>var ourArray = [];</code>",
"<code>for(var i = 10; i > 0; i -= 2) {</code>",
"<code>&thinsp;&thinsp;ourArray.push(i);</code>",
"<code>&nbsp;&nbsp;ourArray.push(i);</code>",
"<code>}</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.",
@@ -992,8 +992,8 @@
"<code>var ourArray = [];</code>",
"<code>var i = 0;</code>",
"<code>while(i < 5) {</code>",
"<code>&thinsp;&thinsp;ourArray.push(i);</code>",
"<code>&thinsp;&thinsp;i++;</code>",
"<code>&nbsp;&nbsp;ourArray.push(i);</code>",
"<code>&nbsp;&nbsp;i++;</code>",
"<code>}</code>",
"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>."
@@ -1140,9 +1140,9 @@
"<code>if</code> statements require some sort of boolean condition to evaluate.",
"For example:",
"<code>if (1 === 2) {</code>",
"<code>&thinsp;&thinsp;return true;</code>",
"<code>&nbsp;&nbsp;return true;</code>",
"<code>} else {</code>",
"<code>&thinsp;&thinsp;return false;</code>",
"<code>&nbsp;&nbsp;return false;</code>",
"<code>}</code>",
"Let's use <code>if</code> and <code>else</code> statements to make a coin-flip game.",
"Create <code>if</code> and <code>else</code> statements to return the string <code>\"heads\"</code> if the flip variable is zero, or else return the string <code>\"tails\"</code> if the flip variable is not zero."
@@ -1460,7 +1460,7 @@
"If all three numbers match, we should return the number that we have in three of slots or leave it as <code>null</code>.",
"Let's create an <code>if statement</code> with multiple conditions in order to check whether all numbers are equal.",
"<code>if(slotOne !== slotTwo || slotTwo !== slotThree){</code>",
"<code>&thinsp;&thinsp;return null;</code>",
"<code>&nbsp;&nbsp;return null;</code>",
"<code>}</code>"
],
"tests": [