2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  "name" :  "Basic JavaScript" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-06 23:11:56 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  "order" :  6 , 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-12 22:56:10 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  "time" :  "3h" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  "challenges" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "bd7123c9c441eddfaeb4bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Comment your JavaScript Code" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.98" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 14:40:02 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "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." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "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:" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>// This is a comment.</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "The slash-star-star-slash comment will comment out everything between the <code>/*</code> and the <code>*/</code> characters:" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>/* This is also a comment */</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-25 04:41:02 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Try creating one of each." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "And one more thing you need to notice. Starting at this waypoint in JavaScript related challenges (except AngularJS, all Ziplines, Git, Node.js and Express.js, MongoDB and Full Stack JavaScript Projects) you can see contents of <code>assert()</code> functions (in some challenges <code>except()</code>, <code>assert.equal()</code> and so on) which are used to test your code. It's part of these challenges that you are able to see the tests that are running against your code." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/(\\/\\/)...../g), 'message: Create a <code>//</code> style comment that contains at least five letters');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/(\\/\\*)[\\w\\W]{5,}(?=\\*\\/)/gm), 'message: Create a <code>/* */</code> style comment that contains at least five letters.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/(\\*\\/)/g), 'message: Make sure that you close the comment with a <code>*/</code>');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-23 16:14:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "bd7123c9c441eddfaeb5bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Understand Boolean Values" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 17:26:24 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "In computer science, <code>data structures</code> are things that hold data. JavaScript has seven of these. For example, the <code>Number</code> data structure holds numbers." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Let's learn about the most basic data structure of all: the <code>Boolean</code>. Booleans can only hold the value of either true or false. They are basically little on-off switches." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Let's modify our <code>welcomeToBooleans</code>function so that it will return <code>true</code>instead of <code>false</code>when the run button is clicked." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(typeof(welcomeToBooleans()) === 'boolean', 'message: The <code>welcomeToBooleans()</code> function should return a boolean (true/false) value.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(welcomeToBooleans() === true, 'message: <code>welcomeToBooleans()</code> should return true.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "function welcomeToBooleans() {" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 20:55:51 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 17:26:24 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  return false;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "}" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "welcomeToBooleans();" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-23 16:14:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "bd7123c9c443eddfaeb5bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Declare JavaScript Variables" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 17:26:24 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "When we store data in a <code>data structure</code>, we call it a <code>variable</code>. These variables are no different from the x and y variables you use in math." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Let's create our first variable and call it \"myName\"." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "You'll notice that in <code>myName</code>, we didn't use a space, and that the \"N\" is capitalized. JavaScript variables are written in <code>camel case</code>. An example of camel case is: camelCase." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Now, use the <code>var</code> keyword to create a variable called <code>myName</code>. Set its value to your name, in double quotes." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Look at the <code>ourName</code> example if you get stuck." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(){if(typeof(myName) !== \"undefined\" && typeof(myName) === \"string\" && myName.length > 0){return true;}else{return false;}})(), 'message: <code>myName</code> should be a string that contains at least one character in it.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// var ourName = \"Free Code Camp\";" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "if(typeof(myName) !== \"undefined\"){(function(v){return v;})(myName);}" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-23 16:14:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "bd7123c9c444eddfaeb5bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Declare String Variables" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "In the previous challenge, we used the code <code>var myName = \"your name\"</code>. This is what we call a <code>String</code> variable. It is nothing more than a \"string\" of characters. JavaScript strings are always wrapped in quotes." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Now let's create two new string variables: <code>myFirstName</code>and <code>myLastName</code> and assign them the values of your first and last name, respectively." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(){if(typeof(myFirstName) !== \"undefined\" && typeof(myFirstName) === \"string\" && myFirstName.length > 0){return true;}else{return false;}})(), 'message: <code>myFirstName</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.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 13:05:51 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// var name = \"Alan Turing\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 17:26:24 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// var firstName = \"Alan\";" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// var lastName = \"Turing\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "if(typeof(myFirstName) !== \"undefined\" && typeof(myLastName) !== \"undefined\"){(function(){return myFirstName + ', ' + myLastName;})();}" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-23 16:14:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "bd7123c9c448eddfaeb5bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Check the Length Property of a String Variable" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 13:05:51 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>Data structures</code> have <code>properties</code>. For example, <code>strings</code> have a property called <code>.length</code> that will tell you how many characters are in the string." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 17:26:24 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "For example, if we created a variable <code>var firstName = \"Charles\"</code>, we could find out how long the string \"Charles\" is by using the <code>firstName.length</code> property." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 09:34:34 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Use the <code>.length</code> property to count the number of characters in the <code>lastName</code> variable." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(){if(typeof(lastNameLength) !== \"undefined\" && typeof(lastNameLength) === \"number\" && lastNameLength === 8){return true;}else{return false;}})(), 'message: <code>lastNameLength</code> should be equal to eight.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert((function(){if(editor.getValue().match(/\\.length/gi) && editor.getValue().match(/\\.length/gi).length >= 2 && editor.getValue().match(/var lastNameLength \\= 0;/gi) && editor.getValue().match(/var lastNameLength \\= 0;/gi).length >= 1){return true;}else{return false;}})(), 'message: You should be getting the length of <code>lastName</code> by using <code>.length</code> like this: <code>lastName.length</code>.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-03 17:01:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var firstNameLength = 0;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "var lastNameLength = 0;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var firstName = \"Ada\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-03 17:01:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "firstNameLength = firstName.length;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var lastName = \"Lovelace\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 20:55:51 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-03 17:01:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "lastNameLength = lastName;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "if(typeof(lastNameLength) !== \"undefined\"){(function(){return lastNameLength;})();}" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-23 16:14:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "bd7123c9c549eddfaeb5bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Use Bracket Notation to Find the First Character in a String" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<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." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "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>." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-17 22:19:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Use <code>bracket notation</code> to find the first character in the <code>firstLetterOfLastName</code> variable." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Try looking at the <code>firstLetterOfFirstName</code> variable declaration if you get stuck." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "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>.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-17 09:52:34 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var firstLetterOfFirstName = \"\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 11:11:25 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var firstLetterOfLastName = \"\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-03 20:43:23 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var firstName = \"Ada\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-03 20:43:23 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "firstLetterOfFirstName = firstName[0];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var lastName = \"Lovelace\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-03 20:43:23 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "firstLetterOfLastName = lastName;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(v){return v;})(firstLetterOfLastName);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-23 16:14:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "bd7123c9c450eddfaeb5bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Use Bracket Notation to Find the Nth Character in a String" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-17 16:58:17 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "You can also use <code>bracket notation</code> to get the character at other positions within a string." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Remember that computers start counting at 0, so the first character is actually the zeroth character." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-17 16:58:17 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Let's try to set <code>thirdLetterOfLastName</code> to equal the <code>third letter</code> of the <code>lastName</code> variable." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Try looking at the <code>secondLetterOfFirstName</code> variable declaration if you get stuck." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(thirdLetterOfLastName === 'v', 'message: The third letter of <code>lastName</code> should be a \"v\".');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var firstName = \"Ada\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "var secondLetterOfFirstName = firstName[1];" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var lastName = \"Lovelace\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "var thirdLetterOfLastName = lastName;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(v){return v;})(thirdLetterOfLastName);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-23 16:14:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "bd7123c9c451eddfaeb5bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Use Bracket Notation to Find the Last Character in a String" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "In order to get the last letter of a string, you can subtract one from the string's length." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "For example, if <code>var firstName = \"Charles\"</code>, you can get the value of the last letter of the string by using <code>firstName[firstName.length - 1]</code>." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Use <code>bracket notation</code> to find the last character in the <code>lastName</code> variable." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-17 23:29:11 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Try looking at the <code>lastLetterOfFirstName</code> variable declaration if you get stuck." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(lastLetterOfLastName === \"e\", 'message: <code>lastLetterOfLastName</code> should be \"e\".');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/\\.length/g).length === 2, 'message: You have to use <code>.length</code> to get the last letter.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var firstName = \"Ada\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "var lastLetterOfFirstName = firstName[firstName.length - 1];" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var lastName = \"Lovelace\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "var lastLetterOfLastName = lastName;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(v){return v;})(lastLetterOfLastName);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-23 16:14:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "bd7123c9c452eddfaeb5bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Use Bracket Notation to Find the Nth-to-Last Character in a String" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "In order to get the last letter of a string, you can subtract one from the string's length." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "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." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-26 18:59:59 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Try looking at the <code>thirdToLastLetterOfFirstName</code> variable declaration if you get stuck." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(secondToLastLetterOfLastName === 'c', 'message: <code>secondToLastLetterOfLastName</code> should be \"c\".');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/\\.length/g).length === 2, 'message: You have to use <code>.length</code> to get the second last letter.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var firstName = \"Ada\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-05 17:31:42 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var thirdToLastLetterOfFirstName = firstName[firstName.length - 3];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var lastName = \"Lovelace\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "var secondToLastLetterOfLastName = lastName;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(v){return v;})(secondToLastLetterOfLastName);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "cf1111c1c11feddfaeb3bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Add Two Numbers with JavaScript" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Let's try to add two numbers using JavaScript." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "JavaScript uses the <code>+</code> symbol for addition." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 01:13:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Replace the <code>0</code> with the correct number so you can get the result mentioned in the comment." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(){if(sum === 20 && editor.getValue().match(/\\+/g).length >= 2){return true;}else{return false;}})(), 'message: Make the variable <code>sum</code> equal 20.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var sum = 10 + 0; //make this equal to 20 by changing the 0 into the appropriate number." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(z){return 'sum='+z;})(sum);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "cf1111c1c11feddfaeb4bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Subtract One Number from Another with JavaScript" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "We can also subtract one number from another." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-17 01:04:00 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "JavaScript uses the <code>-</code> symbol for subtraction." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 01:13:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Replace the <code>0</code> with the correct number so you can get the result mentioned in the comment." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(){if(difference === 12 && editor.getValue().match(/\\-/g)){return true;}else{return false;}})(), 'message: Make the variable <code>difference</code> equal 12.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var difference = 45 - 0; //make this equal to 12 by changing the 0 into the appropriate number." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(z){return 'difference='+z;})(difference);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-25 20:22:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "cf1231c1c11feddfaeb5bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Multiply Two Numbers with JavaScript" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "We can also multiply one number by another." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-17 01:04:00 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "JavaScript uses the <code>*</code> symbol for multiplication." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 01:13:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Replace the <code>0</code> with the correct number so you can get the result mentioned in the comment." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(){if(product === 80 && editor.getValue().match(/\\*/g)){return true;}else{return false;}})(), 'message: Make the variable <code>product</code> equal 80.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 13:05:51 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var product = 8 * 0; // Make this equal to 80 by changing the 0 into the appropriate number." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(z){return 'product='+z;})(product);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "cf1111c1c11feddfaeb6bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Divide One Number by Another with JavaScript" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "We can also divide one number by another." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-17 01:04:00 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "JavaScript uses the <code>/</code> symbol for division." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 01:13:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Replace the <code>0</code> with the correct number so you can get the result mentioned in the comment." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(){if(quotient === 2 && editor.getValue().match(/var\\s*?quotient\\s*?\\=\\s*?\\d+\\s*?\\/\\s*?\\d+\\s*?;/g)){return true;}else{return false;}})(), 'message: Make the variable <code>quotient</code> equal 2.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var quotient = 66 / 0; //make this equal to 2 by changing the 0 into the appropriate number." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(z){return 'quotient='+z;})(quotient);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-25 20:22:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "cf1391c1c11feddfaeb4bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Create Decimal Numbers with JavaScript" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "JavaScript number variables can also have decimals." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-02 21:15:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Let's create a variable <code>myDecimal</code> and give it a decimal value." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(){if(typeof(myDecimal) !== \"undefined\" && typeof(myDecimal) === \"number\" && editor.getValue().match(/\\./g).length >=2){return true;}else{return false;}})(), 'message: <code>myDecimal</code> should be a decimal point number.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 01:13:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// var ourDecimal = 5.7;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 23:44:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Create a number with a decimal point here called myDecimal" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(){if(typeof(myDecimal) !== \"undefined\"){return myDecimal;}})();" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-23 16:14:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "bd7993c9c69feddfaeb7bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Perform Arithmetic Operations on Decimals with JavaScript" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 01:13:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "In JavaScript, you can also perform calculations with decimal numbers, just like whole numbers." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Replace the <code>0.0</code> with the correct number so that you get the result mentioned in the comments." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(){if(product === 5.0 && editor.getValue().match(/\\*/g)){return true;}else{return false;}})(), 'message: Make the variable <code>product</code> equal 5.0.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert((function(){if(quotient === 2.2 && editor.getValue().match(/\\//g)){return true;}else{return false;}})(), 'message: Make the variable <code>quotient</code> equal 2.2.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 01:13:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var quotient = 4.4 / 2.0; // equals 2.2" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "var product = 2.0 * 0.0; // equals 5.0" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(y){return 'product='+y;})(product);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-23 16:14:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "bd7993c9c69feddfaeb8bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Store Multiple Values in one Variable using JavaScript Arrays" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 01:13:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "With JavaScript <code>array</code> variables, we can store several pieces of data in one place." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 14:00:30 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "You start an array declaration with an opening square bracket, end it with a closing square bracket, and put a comma between each entry, like this: <code>var sandwich = [\"peanut butter\", \"jelly\", \"bread\"]</code>." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 20:53:54 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Now let's create a new array called <code>myArray</code> that contains both a <code>string</code> and a <code>number</code> (in that order)." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 23:26:03 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Refer to the commented code in the text editor if you get stuck." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(typeof(myArray) == 'object', 'message: <code>myArray</code> should be an <code>array</code>.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) == 'string', 'message: The first item in <code>myArray</code> should be a <code>string</code>.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(typeof(myArray[1]) !== 'undefined' && typeof(myArray[1]) == 'number', 'message: The second item in <code>myArray</code> should be a <code>number</code>.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 14:00:30 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// var array = [\"John\", 23];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-21 21:22:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var myArray = [];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(z){return z;})(myArray);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "cf1111c1c11feddfaeb7bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Nest one Array within Another Array" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.98161" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 23:26:03 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "You can also nest arrays within other arrays, like this: <code>[[\"Bulls\", 23]]</code>." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 01:13:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Let's now go create a nested array called <code>myArray</code>." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(Array.isArray(myArray) && myArray.some(Array.isArray), 'message: <code>myArray</code> should have at least one array nested within another array.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 11:11:25 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var ourArray = [[\"the universe\", \"everything\", 42]];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-21 21:22:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var myArray = [];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "bg9997c9c79feddfaeb9bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Access Array Data with Indexes" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.9817" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "We can access the data inside arrays using <code>indexes</code>." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "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." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "For example:" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>var array = [1,2,3];</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>array[0]; //equals 1</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>var data = array[1];</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Create a variable called <code>myData</code> and set it to equal the first value of <code>myArray</code>." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(){if(typeof(myArray) != 'undefined' && typeof(myData) != 'undefined' && myArray[0] == myData){return true;}else{return false;}})(), 'message: The variable <code>myData</code> should equal the first value of <code>myArray</code>.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 14:00:30 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// var ourArray = [1,2,3];" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// var ourData = ourArray[0]; // equals 1" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "var myArray = [1,2,3];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "if(typeof(myArray) !== \"undefined\" && typeof(myData) !== \"undefined\"){(function(y,z){return 'myArray = ' + JSON.stringify(y) + ', myData = ' + JSON.stringify(z);})(myArray, myData);}" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "cf1111c1c11feddfaeb8bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Modify Array Data With Indexes" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.98171" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "We can also modify the data stored in arrays by using indexes." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "For example:" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>var ourArray = [3,2,1];</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>ourArray[0] = 1; // equals [1,2,1]</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Now modify the data stored at index 0 of <code>myArray</code> to the value of 3." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(){if(typeof(myArray) != 'undefined' && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return true;}else{return false;}})(), 'message: <code>myArray</code> should now be [3,2,3].');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert((function(){if(editor.getValue().match(/myArray\\[0\\]\\s?=\\s?/g)){return true;}else{return false;}})(), 'message: You should be using correct index to modify the value in <code>myArray</code>.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var ourArray = [1,2,3];" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "ourArray[1] = 3;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-28 01:04:59 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// ourArray now equals [1,3,3]." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var myArray = [1,2,3];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-23 16:14:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "bg9994c9c69feddfaeb9bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Manipulate Arrays With pop()" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Another way to change the data in an array is with the <code>.pop()</code> function." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>.pop()</code>is used to \"pop\" a value off of the end of an array. We can retrieve this value by performing <code>pop()</code> in a variable declaration." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Any type of variable can be \"popped\" off of an array." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 14:00:30 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Use the <code>.pop()</code> function to remove the last item from <code>myArray</code>." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(d){if(d[0] == 'John' && d[1] == 23 && d[2] == undefined){return true;}else{return false;}})(myArray), 'message: <code>myArray</code> should only contain <code>[\"John\", 23]</code>.');" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-15 16:27:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(d){if(d[0] == 'cat' && d[1] == 2 && d[2] == undefined){return true;}else{return false;}})(removed), 'message: <code>removed</code> should only contain <code>[\"cat\", 2]</code>.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 14:00:30 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// var numbers = [1,2,3];" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// console.log(numbers); // logs [1,2,3]" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// var removed = numbers.pop();" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// console.log(numbers); // logs [1,2]" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// console.log(removed); // logs 3" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 15:32:40 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var myArray = [\"John\", 23, [\"cat\", 2]];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-17 20:08:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var removed = myArray; // This should be [\"cat\", 2] and myArray should now be [\"John\", 23]" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z);})(myArray, removed);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-23 16:14:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "bg9995c9c69feddfaeb9bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Manipulate Arrays With push()" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Not only can you <code>pop()</code> data off of the end of an array, you can also <code>push()</code> data onto the end of an array." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 14:00:30 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Take the <code>myArray</code> array and <code>push()</code> this value to the end of it: <code>[\"dog\", 3]</code>." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(d){if(d[2] != undefined && d[0] == 'John' && d[1] == 23 && d[2][0] == 'dog' && d[2][1] == 3 && d[2].length == 2){return true;}else{return false;}})(myArray), 'message: <code>myArray</code> should now equal <code>[\"John\", 23, [\"dog\", 3]]</code>.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "ourArray.pop();" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "ourArray.push([\"happy\", \"joy\"]);" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 14:00:30 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// ourArray now equals [\"Stimpson\", \"J\", [\"happy\", \"joy\"]]." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 15:32:40 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var myArray = [\"John\", 23, [\"cat\", 2]];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "myArray.pop();" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 14:00:30 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Add a [\"dog\", 3] to the end of myArray using push()." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(z){return 'myArray = ' + JSON.stringify(z);})(myArray);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-23 16:14:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "bg9996c9c69feddfaeb9bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Manipulate Arrays With shift()" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>pop()</code> always removes the last element of an array. What if you want to remove the first? That's where <code>.shift()</code> comes in." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 14:00:30 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Take the <code>myArray</code> array and <code>shift()</code> the first value off of it. Set <code>myRemoved</code> to the first value of <code>myArray</code> using <code>shift()</code>." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(d){if(d[0] == 23 && d[1][0] == 'dog' && d[1][1] == 3 && d[2] == undefined){return true;}else{return false;}})(myArray), 'message: <code>myArray</code> should now equal <code>[23, [\"dog\", 3]]</code>.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert((function(d){if(d === 'John' && typeof(myRemoved) === 'string'){return true;}else{return false;}})(myRemoved), 'message: <code>myRemoved</code> should contain <code>\"John\"</code>.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "ourRemoved = ourArray.shift();" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 14:00:30 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// ourArray now equals [\"J\", [\"cat\"]]." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 15:32:40 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var myArray = [\"John\", 23, [\"dog\", 3]];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 14:00:30 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var myRemoved = myArray; // This should be [\"John\"] and myArray should now be [23, [\"dog\", 3]]." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-17 21:12:19 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & myRemoved = ' + JSON.stringify(z);})(myArray, myRemoved);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-23 16:14:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" :  "bg9997c9c69feddfaeb9bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Manipulate Arrays With unshift()" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 14:00:30 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Now that we've learned how to <code>shift</code>things from the start of the array, we need to learn how to <code>unshift</code>stuff back to the start." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Let's take the code we had last time and <code>unshift</code>this value to the start: <code>\"Paul\"</code>." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(d){if(typeof(d[0]) === \"string\" && d[0].toLowerCase() == 'paul' && d[1] == 23 && d[2][0] != undefined && d[2][0] == 'dog' && d[2][1] != undefined && d[2][1] == 3){return true;}else{return false;}})(myArray), 'message: <code>myArray</code> should now have [\"Paul\", 23, [\"dog\", 3]]).');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "ourArray.shift();" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-28 03:45:13 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// ourArray now equals [\"J\", [\"cat\"]]" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 20:59:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "ourArray.unshift(\"happy\");" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-28 03:45:13 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// ourArray now equals [\"happy\", \"J\", [\"cat\"]]" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 15:32:40 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var myArray = [\"John\", 23, [\"dog\", 3]];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "myArray.shift();" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 14:00:30 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Add \"Paul\" to the start of myArray." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(y, z){return 'myArray = ' + JSON.stringify(y);})(myArray);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "bg9997c9c89feddfaeb9bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Write Reusable JavaScript with Functions" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.9819" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 16:02:25 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "In JavaScript, we can divide up our code into reusable parts called functions." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Here's an example of a function:" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 16:02:25 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>function functionName(a, b) {</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>  return a + b;</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>}</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 16:02:25 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "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>." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "In this example, the function will return the number <code>6</code> as this is the result of <code>4 + 2</code>." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Create and call a function called <code>myFunction</code> that returns the sum of <code>a</code> and <code>b</code>." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(){if(typeof(f) !== \"undefined\" && f === a + b){return true;}else{return false;}})(), 'message: Your function should return the value of a + b');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var a = 4;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "var b = 5;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 14:04:52 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "function ourFunction(a, b) {" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  return a - b;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 02:40:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "}" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 05:19:45 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Create a function called myFunction that returns the value of a plus b." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// You'll learn about functions soon." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 01:13:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "if(typeof(myFunction) !== \"undefined\"){" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var f=myFunction(a,b);" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(){return f;})();" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 21:55:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "}" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "bg9998c9c99feddfaeb9bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Build JavaScript Objects" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.9822" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "You may have heard the term <code>object</code> before." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "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>  \"name\": \"Whiskers\",</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>  \"legs\": 4,</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>  \"tails\": 1,</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>  \"enemies\": [\"Water\", \"Dogs\"]</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>};</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-29 18:30:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Objects are useful for storing data in a structured way, and can represent real world objects, like a cat." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 15:05:34 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Let's try to make an object that represents a dog called <code>myDog</code> which contains the properties <code>'name'</code> (String), <code>'legs'</code> (Number), <code>'tails'</code> (Number) and <code>'friends'</code> (Array)!" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(z){if(z.hasOwnProperty(\"name\") && z.name !== undefined && typeof(z.name) === \"string\"){return true;}else{return false;}})(myDog), 'message: <code>myDog</code> should contain the property <code>name</code> and it should be a <code>string</code>.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert((function(z){if(z.hasOwnProperty(\"legs\") && z.legs !== undefined && typeof(z.legs) === \"number\"){return true;}else{return false;}})(myDog), 'message: <code>myDog</code> should contain the property <code>legs</code> and it should be a <code>number</code>.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert((function(z){if(z.hasOwnProperty(\"tails\") && z.tails !== undefined && typeof(z.tails) === \"number\"){return true;}else{return false;}})(myDog), 'message: <code>myDog</code> should contain the property <code>tails</code> and it should be a <code>number</code>.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert((function(z){if(z.hasOwnProperty(\"friends\") && z.friends !== undefined && Array.isArray(z.friends)){return true;}else{return false;}})(myDog), 'message: <code>myDog</code> should contain the property <code>friends</code> and it should be an <code>array</code>.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 15:05:34 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// var ourDog = {" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 20:06:47 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "//   \"name\": \"Camper\"," , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "//   \"legs\": 4," , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "//   \"tails\": 1," , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 20:08:37 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "//   \"friends\": [\"everything!\"]" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 15:05:34 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// };" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 15:05:34 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Add the name (string), legs (number), tails (number) and friends (array) properties to myDog." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// You can set them to whatever you want." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code below this line." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var myDog = {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "};" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(z){return z;})(myDog);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "bg9999c9c99feddfaeb9bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Manipulate JavaScript Objects" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.9823" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-17 22:31:37 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "There are many ways to add and remove properties from objects." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "For example, we can add properties to objects like this:" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-05 17:31:42 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>myObject.myProperty = \"myValue\";</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "We can also delete them like this:" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-21 12:37:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>delete myObject.myProperty;</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 15:05:34 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Let's add the property <code>\"bark\"</code>, and delete the property <code>\"tails\"</code>." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(myDog.bark !== undefined, 'message: Add the property <code>\"bark\"</code> to <code>myDog</code>.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(myDog.tails === undefined, 'message: Delete the property <code>\"tails\"</code> from <code>myDog</code>.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-09 00:26:16 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 11:11:25 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// var ourDog = {" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 20:06:47 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "//   \"name\": \"Camper\"," , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "//   \"legs\": 4," , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "//   \"tails\": 1," , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 20:08:37 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "//   \"friends\": [\"everything!\"]" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 11:11:25 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// };" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-21 20:20:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// ourDog.bark = \"arf!\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-21 12:37:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// delete ourDog.tails;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "var myDog = {" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 15:32:40 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "   \"name\": \"Camper\"," , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-01 00:47:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "   \"legs\": 4," , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   \"tails\": 1," , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "   \"friends\": []" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "};" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 11:11:25 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Let's add the property bark to myDog" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 11:11:25 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Now delete the property tails" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(z){return z;})(myDog);" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "cf1111c1c11feddfaeb5bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Iterate with JavaScript For Loops" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.9824" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "You can run the same code multiple times by using a loop." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "The most common type of JavaScript loop is called a \"for loop\" because it runs \"for\" a specific number of times." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>var ourArray = [];</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>for(var i = 0; i < 5; i++) {</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 11:11:25 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>  ourArray.push(i);</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>}</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>ourArray</code> will now contain [0,1,2,3,4] " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Let's try getting a for loop to work by pushing values to an array." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/for/g), '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 [0,1,2,3,4].');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-10 09:17:36 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var ourArray = [];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-21 22:01:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "for(var i = 0; i < 5; i++){" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  ourArray.push(i);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "}" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var myArray = [];" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-01 13:41:40 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code below this line." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// Push the numbers zero through four to myArray using a \"for loop\" like above." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// 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;})();}" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "cf1111c1c11feddfaeb1bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Iterate with JavaScript While Loops" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.9825" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "You can run the same code multiple times by using a loop." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 00:17:56 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Another type of JavaScript loop is called a \"while loop\", because it runs \"while\" something is true and stops once that something is no longer true." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>var ourArray = [];</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>var i = 0;</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>while(i < 5) {</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 11:11:25 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>  ourArray.push(i);</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>  i++;</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>}</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-22 20:26:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Let's try getting a while loop to work by pushing values to an array." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "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 [0,1,2,3,4].');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "var myArray = [];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-08 10:58:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code below this line." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "// Push the numbers zero through four to myArray using a \"while loop\"." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-08 10:58:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// 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;})();}" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "cf1111c1c11feddfaeb9bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Generate Random Fractions with JavaScript" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.9827" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 00:22:33 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Random numbers are useful for creating random behavior." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 13:50:20 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "JavaScript has a <code>Math.random()</code> function that generates a random decimal number." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Use <code>Math.random()</code> to get <code>myFunction</code> to return a random number." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-16 11:06:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(typeof(myFunction()) === \"number\", 'message: <code>myFunction</code> should return a random number.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert((myFunction()+''). match(/\\./g), 'message: The number returned by <code>myFunction</code> should be a decimal.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/Math\\.random/g).length >= 2, 'message: You should be using <code>Math.random</code> to generate the random decimal number.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-16 11:06:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 01:13:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "function myFunction() {" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 15:05:34 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Change the 0 to Math.random()." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Only change code below this line." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  return 0;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 23:26:03 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "}" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-16 11:06:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(){return myFunction();})();" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-16 11:06:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-16 11:06:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "cf1111c1c12feddfaeb1bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Generate Random Whole Numbers with JavaScript" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-16 11:06:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.9828" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-20 17:21:10 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "It's great that we can create random decimal numbers, but it's even more useful if we use it to generate a random whole number." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-08 16:57:56 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "To achieve this we can multiply the random number by ten and use the <code>Math.floor()</code> to convert the decimal number to the nearest less than or equal whole number." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-22 18:06:24 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "This technique gives us a whole number between zero and nine." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Example:" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>Math.floor(Math.random()*10);</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-22 18:06:24 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Let's give this technique a go now." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(typeof(myFunction()) === \"number\", 'message: The result of <code>myFunction</code> should be a number.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/Math.random/g), 'message: You should be using Math.random to create a random number.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/\\(\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\*\\s*?10\\s*?\\)/g) || editor.getValue().match(/\\(\\s*?10\\s*?\\*\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\)/g), 'message: You should have multiplied the result of <code>Math.random</code> by 10 to make it a number that is between zero and nine.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/Math.floor/g), 'message: You should use <code>Math.floor</code> to remove the decimal part of the number.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-16 11:06:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "function myFunction(){" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-08 16:57:56 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Make myFunction return a random number between zero and nine instead of a decimal." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  // Only change code below this line." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  return Math.random();" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  // Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-16 11:06:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "}" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(){return myFunction();})();" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-16 11:06:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-16 11:06:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "cf1111c1c12feddfaeb2bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Generate Random Whole Numbers within a Range" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-16 11:06:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.9829" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-17 16:42:20 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "We can use a certain mathematical expression to get a random number between two numbers." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 23:26:03 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>Math.floor(Math.random() * (max - min + 1)) + min</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "By using this, we can control the output of a random number." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(myFunction() >= min, 'message: The random number generated by <code>myFunction</code> should be greater than or equal to the minimum number.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(myFunction() <= max, 'message: The random number generated by <code>myFunction</code> should be less than or equal to the maximum number.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(myFunction() % 1 === 0 , 'message: The random number generated by <code>myFunction</code> should be an integer, not a decimal.');" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-18 13:44:17 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(){if(editor.getValue().match(/max/g).length >= 3 && editor.getValue().match(/min/g).length >= 4 && editor.getValue().match(/Math.floor/g) && editor.getValue().match(/Math.random/g)){return true;}else{return false;}})(), 'message: You should be using the function given in the description to calculate the random in number in a range.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-18 13:44:17 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var min = 1;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-19 19:12:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var max = 9;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 01:13:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "function myFunction() {" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-08 17:47:06 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Make myFunction return a random number between min and max values instead of a decimal" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Only change code below this line." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  return Math.random();" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "}" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "(function(){return myFunction();})();" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "cf1111c1c12feddfaeb3bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 23:26:03 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Use Conditional Logic with If and Else Statements" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.983" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 23:26:03 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "We can use <code>if</code> statements in JavaScript to only execute code if a certain condition is met." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>if</code> statements require some sort of boolean condition to evaluate." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "For example:" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-17 22:21:57 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code> if (1 === 2) {</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>  return true;</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 23:26:03 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>} else {</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>  return false;</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-17 16:34:45 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>}</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 11:11:25 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Let's use <code>if</code> and <code>else</code> statements to make a coin-flip game." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 23:26:03 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "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." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((function(){var result = myFunction();if(result === 'heads' || result === 'tails'){return true;} else {return false;}})(), 'message: <code>myFunction</code> should either return <code>heads</code> or <code>tails</code>.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert((function(){var result = myFunction();if(result === 'heads' && flip === 0 || result === 'tails' && flip !== 0){return true;} else {return false;}})(), 'message: <code>myFunction</code> should return <code>heads</code> when flip equals 0 and <code>tails</code> when flip equals 1.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/if/g).length >= 4, 'message: You should have created a new if statement.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/else/g).length >= 2, 'message: You should have created a new else statement.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-08 17:21:12 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "function myFunction(){" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-17 23:01:52 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Create an if-else statement here to return \"heads\" if flip is 0. Otherwise return \"tails\"." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 11:11:25 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Only change code below this line." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-07 22:54:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  // Only change code above this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "}" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-13 22:07:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "// We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-08 17:21:12 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var result = myFunction();if(typeof(flip) !== \"undefined\" && typeof(flip) === \"number\" && typeof(result) !== \"undefined\" && typeof(result) === \"string\"){(function(y,z){return 'flip = ' + y.toString() + ', text = ' + z;})(flip, result);}" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "cf1111c1c12feddfaeb6bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Sift through Text with Regular Expressions" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.984" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 20:14:12 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>Regular expressions</code> are used to find certain words or patterns inside of <code>strings</code>." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-22 19:05:41 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "For example, if we wanted to find the word <code>the</code> in the string <code>The dog chased the cat</code>, we could use the following <code>regular expression</code>: <code>\/the\/gi</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 11:11:25 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Let's break this down a bit:" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>the</code> is the pattern we want to match." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-22 19:05:41 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>g</code> means that we want to search the entire string for this pattern instead of just the first match." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 15:56:56 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>i</code> means that we want to ignore the case (uppercase or lowercase) when searching for the pattern." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 23:26:03 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>Regular expressions</code> are written by surrounding the pattern with <code>/</code> symbols." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Let's try selecting all the occurrences of the word <code>and</code> in the string <code>Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it</code>. We can do this by replacing the <code>.</code> part of our regular expression with the current <code>regular expression</code> with the word <code>and</code>." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(test==2, 'message: Your <code>regular expression</code> should find two occurrences of the word <code>and</code>.');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/\\/and\\/gi/), 'message: You should have used <code>regular expressions</code> to find the word <code>and</code>.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 01:13:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var test = (function() {" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 23:26:03 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  var testString = \"Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.\";" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  var expressionToGetSoftware = /software/gi;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-30 20:37:32 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  var expression = /./gi;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 15:56:56 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Only change code above this line." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  // We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  return testString.match(expression).length;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "})();(function(){return test;})();" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "cf1111c1c12feddfaeb7bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Find Numbers with Regular Expressions" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.985" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 15:33:21 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "We can use special selectors in <code>Regular Expressions</code> to select a particular type of value." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 11:11:25 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "One such selector is the digit selector <code>\\d</code> which is used to grab the numbers in a string." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-12 15:00:04 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "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." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Use the <code>\\d</code> selector to select the number of numbers in the string, allowing for the possibility of multi-digit numbers." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(test === 2, 'message: Your RegEx should have found two numbers in the <code>testString</code>.');" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-06 10:27:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/\\/\\\\d\\+\\//g), 'message: You should be using the following expression <code>/\\d+/g</code> to find the numbers in the <code>testString</code>.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 01:13:07 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "var test = (function() {" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-17 22:54:08 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  var testString = \"There are 3 cats but 4 dogs.\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-06 10:27:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  var expression = /.+/g;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 15:56:56 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Only change code above this line." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  // We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  return testString.match(expression).length;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "})();(function(){return test;})();" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 16:08:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "id" : "cf1111c1c12feddfaeb8bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-06 08:45:21 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Find Whitespace with Regular Expressions" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-01 16:10:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.986" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-06 08:45:21 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "We can also use selectors like <code>\\s</code> to find whitespace in a string." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "The whitespace characters are <code>\" \"</code> (space), <code>\\r</code> (carriage return), <code>\\n</code> (newline), <code>\\t</code> (tab), and <code>\\f</code> (form feed)." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "It is used like this:" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>/\\s+/g</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-06 08:45:21 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Select all the whitespace characters in the sentence string." 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(test === 7, 'message: Your RegEx should have found seven spaces in the <code>testString</code>.');" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-06 10:27:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/\\/\\\\s\\+\\//g), 'message: You should be using the following expression <code>/\\s+/g</code> to find the spaces in the <code>testString</code>.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "var test = (function(){" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  var testString = \"How many spaces are there in this sentence?\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-06 10:27:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  var expression = /.+/g;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Only change code above this line." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  // We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  return testString.match(expression).length;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "})();(function(){return test;})();" 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-24 00:38:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-10 00:56:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" :  1 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-30 20:58:02 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-01 19:12:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "id" : "cf1111c1c13feddfaeb3bdef" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Invert Regular Expression Matches with JavaScript" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-01 19:12:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.987" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-06 10:27:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Use <code>/\\S/g</code> to match everything that isn't a space in the string." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 11:11:25 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "You can invert any match by using the uppercase version of the selector <code>\\s</code> versus <code>\\S</code> for example." 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-01 19:12:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(test === 49, 'message: Your RegEx should have found forty nine non-space characters in the <code>testString</code>.');" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-06 10:27:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(editor.getValue().match(/\\/\\\\S\\/g/g), 'message: You should be using the following expression <code>/\\S/g</code> to find non-space characters in the <code>testString</code>.');" 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-01 19:12:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "var test = (function(){" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-18 15:17:26 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  var testString = \"How many non-space characters are there in this sentence?\";" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-01 19:12:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Only change code below this line." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-01 19:12:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-06 10:27:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  var expression = /./g;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-01 19:12:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  // Only change code above this line." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  // We use this function to show you the value of your variable in your output box." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  return testString.match(expression).length;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "})();(function(){return test;})();" 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-01 19:12:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-07 23:37:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-01 19:12:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "challengeType" : 1 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "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." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "For this we will need to generate three random numbers between <code>1</code> and <code>3</code> to represent the possible values of each individual slot." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Store the three random numbers in <code>slotOne</code>, <code>slotTwo</code> and <code>slotThree</code>." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-10 17:26:34 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Generate the random numbers by using the system we used earlier (an explanation of the formula can be found <a href=\"https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Waypoint-Generate-Random-Whole-Numbers-within-a-Range#explanation\">here</a>):" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>Math.floor(Math.random() * (3 - 1 + 1)) + 1;</code>" 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-07 18:33:01 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert(typeof(runSlots($(\".slot\"))[0]) === \"number\", '<code>slotOne</code> should be a random number.')" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(typeof(runSlots($(\".slot\"))[1]) === \"number\", '<code>slotTwo</code> should be a random number.')" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(typeof(runSlots($(\".slot\"))[2]) === \"number\", '<code>slotThree</code> should be a random number.')" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert((function(){if(editor.match(/Math\\.floor\\(\\s?Math\\.random\\(\\)\\s?\\*\\s?\\(\\s?3\\s?\\-\\s?1\\s?\\+\\s?1\\s?\\)\\s?\\)\\s?\\+\\s?1;/gi) !== null){return editor.match(/Math\\.floor\\(\\s?Math\\.random\\(\\)\\s?\\*\\s?\\(\\s?3\\s?\\-\\s?1\\s?\\+\\s?1\\s?\\)\\s?\\)\\s?\\+\\s?1;/gi).length >= 3;}else{return false;}})(), 'You should have used <code>Math.floor(Math.random() * (3 - 1 + 1)) + 1;</code> three times to generate your random numbers.')" 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "fccss" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  function runSlots(){" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    var slotOne;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    var slotTwo;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    var slotThree;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   " , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    var images = [\"http://i.imgur.com/9H17QFk.png\", \"http://i.imgur.com/9RmpXTy.png\", \"http://i.imgur.com/VJnmtt5.png\"];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "   " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    // 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);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    }" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    return [slotOne, slotTwo, slotThree];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  $(document).ready(function(){" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     $(\".go\").click(function(){" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       runSlots();" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     });" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   });" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "fcces" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " <div class = \"container inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = \"header inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <img src=\"https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz\" alt=\"learn to code javascript at Free Code Camp logo\" class=\"img-responsive nav-logo\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <h2>FCC Slot Machine</h2>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = \"slots inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <div class = \"slot inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <div class = \"slot inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <div class = \"slot inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <br/>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = \"outset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <button class = \"go inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       Go" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </button>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <br/>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = \"foot inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <span class = \"logger\"></span>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "</div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<style>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .container {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #4a2b0f;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 400px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   width: 260px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 50px auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 4px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .header {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 4px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 55px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 14px auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #457f86" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .header h2 {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 30px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .header h2 {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   font-size: 14px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 0 0;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   padding: 0;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   color: #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   text-align: center;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .slots{" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   display: flex;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #457f86;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 6px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .slot{" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   flex: 1 0 auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background: white;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 75px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 8px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #215f1e;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 4px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .go {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   width: 100%;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   color: #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #457f86;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 2px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   box-sizing: none;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   outline: none!important;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .foot {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 150px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: 457f86;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .logger {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   color: white;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 10px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .outset {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -webkit-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -moz-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .inset {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -webkit-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -moz-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "</style>" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeType" :  0 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "id" : "cf1111c1c13feddfaeb1bdef" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "title" :  "Add your JavaScript Slot Machine Slots" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.989" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Now that our slots will each generate random numbers, we need to check whether they've all returned the same number." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "If they have, we should notify our user that they've won." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Otherwise, we should return <code>null</code>, which is a JavaScript data structure that means nothing." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-22 17:40:59 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "If all three numbers match, we should return the number that we have in three of slots or leave it as <code>null</code>." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Let's create an <code>if statement</code> with multiple conditions in order to check whether all numbers are equal." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>if(slotOne !== slotTwo || slotTwo !== slotThree){</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>  return null;</code>" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "<code>}</code>" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 15:05:34 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "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 <code>null</code>.')" 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "fccss" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  function runSlots(){" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    var slotOne;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    var slotTwo;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    var slotThree;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    var images = [\"http://i.imgur.com/9H17QFk.png\", \"http://i.imgur.com/9RmpXTy.png\", \"http://i.imgur.com/VJnmtt5.png\"];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    slotOne = Math.floor(Math.random() * (3 - 1 + 1)) + 1;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    $(\".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);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    }" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    return [slotOne, slotTwo, slotThree];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  $(document).ready(function(){" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     $(\".go\").click(function(){" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       runSlots();" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     });" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   });" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "fcces" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " <div class = \"container inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = \"header inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <img src=\"https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz\" alt=\"learn to code javascript at Free Code Camp logo\" class=\"img-responsive nav-logo\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <h2>FCC Slot Machine</h2>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = \"slots inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <div class = \"slot inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <div class = \"slot inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <div class = \"slot inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <br/>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = \"outset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <button class = \"go inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       Go" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </button>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <br/>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = \"foot inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <span class = \"logger\"></span>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "</div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<style>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .container {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #4a2b0f;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 400px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   width: 260px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 50px auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 4px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .header {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 4px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 55px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 14px auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #457f86" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .header h2 {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 30px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .header h2 {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   font-size: 14px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 0 0;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   padding: 0;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   color: #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   text-align: center;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .slots{" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   display: flex;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #457f86;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 6px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .slot{" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   flex: 1 0 auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background: white;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 75px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 8px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #215f1e;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 4px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .go {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   width: 100%;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   color: #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #457f86;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 2px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   box-sizing: none;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   outline: none!important;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .foot {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 150px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: 457f86;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .logger {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   color: white;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 10px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .outset {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -webkit-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -moz-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .inset {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -webkit-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -moz-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "</style>" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "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." , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Let's use the jQuery <code>selector</code> <code>$(\".slot\")</code> to select all of the slots." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Once they are all selected, we can use <code>bracket notation</code> to access each individual slot:" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>$($(\".slot\")[0]).html(slotOne);</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "This jQuery will select the first and update the slot's HTML to display the correct number." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Use the above selector to display each number in its corresponding slot." 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 15:05:34 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "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((editor.match( /\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)/gi) && editor.match( /\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)/gi ).length >= 3 && editor.match( /\\.html\\(slotOne\\)/gi ) && editor.match( /\\.html\\(slotTwo\\)/gi ) && editor.match( /\\.html\\(slotThree\\)/gi )), 'You should have used the the selector given in the description to select each slot and assign it the value of <code>slotOne</code>, <code>slotTwo</code> and <code>slotThree</code> respectively.')" 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "fccss" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  function runSlots(){" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    var slotOne;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    var slotTwo;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    var slotThree;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    var images = [\"http://i.imgur.com/9H17QFk.png\", \"http://i.imgur.com/9RmpXTy.png\", \"http://i.imgur.com/VJnmtt5.png\"];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    slotOne = Math.floor(Math.random() * (3 - 1 + 1)) + 1;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    $(\".logger\").html(\"\");" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    $(\".logger\").html(\"Not A Win\")" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    // Only change code below this line." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    // Only change code above this line." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    if(slotOne !== slotTwo || slotTwo !== slotThree){" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "      return null;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "      $(\".logger\").html(slotOne);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "      $(\".logger\").append(\" \" + slotTwo);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "      $(\".logger\").append(\" \" + slotThree);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    return [slotOne, slotTwo, slotThree];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  $(document).ready(function(){" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     $(\".go\").click(function(){" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       runSlots();" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     });" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   });" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "fcces" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " <div class = \"container inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = \"header inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <img src=\"https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz\" alt=\"learn to code javascript at Free Code Camp logo\" class=\"img-responsive nav-logo\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <h2>FCC Slot Machine</h2>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = \"slots inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <div class = \"slot inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <div class = \"slot inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <div class = \"slot inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <br/>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = \"outset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <button class = \"go inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       Go" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </button>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <br/>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = \"foot inset\">" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <span class = \"logger\"></span>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "</div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<style>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .container {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #4a2b0f;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 400px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   width: 260px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 50px auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 4px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .header {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 4px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 55px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 14px auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #457f86" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .header h2 {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 30px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .header h2 {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   font-size: 14px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 0 0;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   padding: 0;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   color: #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   text-align: center;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .slots{" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   display: flex;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #457f86;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 6px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .slot{" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   flex: 1 0 auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background: white;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 75px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 8px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #215f1e;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 4px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   text-align: center;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   padding-top: 25px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .go {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   width: 100%;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   color: #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #457f86;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 2px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   box-sizing: none;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   outline: none!important;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .foot {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 150px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: 457f86;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .logger {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   color: white;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 10px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .outset {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -webkit-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -moz-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .inset {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -webkit-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -moz-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "</style>" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeType" :  0 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "id" : "cf1111c1c11feddfaeb1bdff" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-30 18:33:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "title" :  "Give your JavaScript Slot Machine some Stylish Images" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      "difficulty" : "9.9901" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "description" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "Now let's add some images to our slots." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "We've already set up the images for you in an array called <code>images</code>. We can use different indexes to grab each of these." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Here's how we would set the first slot to show a different image depending on which number its random number generates:" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<code>$($('.slot')[0]).html('<img src = \"' + images[slotOne-1] + '\">');</code>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "Set up all three slots like this, then click the \"Go\" button to play the slot machine." 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "tests" : [ 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-05 15:05:34 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "assert((editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)\\.html\\(\\s*?\\'\\<img\\s?src\\s?=\\s?\"\\'\\s?\\+\\s?images\\[\\w+\\-1\\]\\s?\\+\\s?\\'\"\\>\\'\\s*?\\);/gi) && editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)\\.html\\(\\s*?\\'\\<img\\s?src\\s?=\\s?\"\\'\\s?\\+\\s?images\\[\\w+\\-1\\]\\s?\\+\\s?\\'\"\\>\\'\\s*?\\);/gi).length >= 3), 'Use the provided code three times. One for each slot.')" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[0\\]\\s*?\\)/gi), 'You should have used <code>$('.slot')[0]</code> at least once.')" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[1\\]\\s*?\\)/gi), 'You should have used <code>$('.slot')[1]</code> at least once.')" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[2\\]\\s*?\\)/gi), 'You should have used <code>$('.slot')[2]</code> at least once.')" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.match(/slotOne/gi) && editor.match(/slotOne/gi).length >= 7, 'You should have used the <code>slotOne</code> value at least once.')" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.match(/slotTwo/gi) && editor.match(/slotTwo/gi).length >= 8, 'You should have used the <code>slotTwo</code> value at least once.')" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "assert(editor.match(/slotThree/gi) && editor.match(/slotThree/gi).length >= 7, 'You should have used the <code>slotThree</code> value at least once.')" 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeSeed" : [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "fccss" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  function runSlots(){" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    var slotOne;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    var slotTwo;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    var slotThree;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    var images = [\"http://i.imgur.com/9H17QFk.png\", \"http://i.imgur.com/9RmpXTy.png\", \"http://i.imgur.com/VJnmtt5.png\"];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 04:05:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    slotOne = Math.floor(Math.random() * (3 - 1 + 1)) + 1;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    $('.logger').html('');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    $('.logger').html('Not A Win');" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    // Only change code below this line." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    // Only change code above this line." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    if(slotOne !== slotTwo || slotTwo !== slotThree){" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "      return null;" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "      $('.logger').html(slotOne);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "      $('.logger').append(' ' + slotTwo);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "      $('.logger').append(' ' + slotThree);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "    " , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 22:18:09 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "    return [slotOne, slotTwo, slotThree];" , 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-15 13:57:44 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "  }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  $(document).ready(function(){" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     $('.go').click(function(){" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       runSlots();" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     });" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   });" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "fcces" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " <div class = 'container inset'>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = 'header inset'>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <img src='https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz' alt='learn to code javascript at Free Code Camp logo' class='img-responsive nav-logo'>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <h2>FCC Slot Machine</h2>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = 'slots inset'>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <div class = 'slot inset'>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <div class = 'slot inset'>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <div class = 'slot inset'>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <br/>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = 'outset'>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <button class = 'go inset'>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "       Go" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     </button>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <br/>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   <div class = 'foot inset'>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     <span class = 'logger'></span>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " </div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "</div>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "<style>" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .slot > img {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  margin: 0!important;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  height: 71px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "  width: 50px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .container {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #4a2b0f;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 400px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   width: 260px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 50px auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 4px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .header {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 4px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 55px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 14px auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #457f86" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .header h2 {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 30px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .header h2 {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   font-size: 14px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 0 0;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   padding: 0;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   color: #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   text-align: center;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .slots{" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   display: flex;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #457f86;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 6px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .slot{" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   flex: 1 0 auto;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background: white;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 75px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   width: 50px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 8px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #215f1e;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 4px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   text-align: center;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .go {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   width: 100%;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   color: #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: #457f86;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border-radius: 2px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   box-sizing: none;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   outline: none!important;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .foot {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   height: 150px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   background-color: 457f86;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   border: 2px solid #fff;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .logger {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   color: white;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   margin: 10px;" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .outset {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -webkit-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -moz-box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "     box-shadow: 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " .inset {" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -webkit-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   -moz-box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "   box-shadow: inset 0px 0px 15px -2px rgba(0,0,0,0.75);" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " }" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "</style>" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "type" :  "waypoint" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "challengeType" :  0 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-05 17:12:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}