Add and addtional example code and fix the console output
This commit: * Adds an addtional example to the challenge Waypoint: Accessing Objects Properties with Variables * Adds the tail to display the console output Tested locally. Closes #6112
This commit is contained in:
		@@ -3221,6 +3221,8 @@
 | 
				
			|||||||
        "Another use of bracket notation on objects is to use a variable to access a property. This can be very useful for iterating through lists of the object properties or for doing the lookup.",
 | 
					        "Another use of bracket notation on objects is to use a variable to access a property. This can be very useful for iterating through lists of the object properties or for doing the lookup.",
 | 
				
			||||||
        "Here is an example of using a variable to access a property:",
 | 
					        "Here is an example of using a variable to access a property:",
 | 
				
			||||||
        "<blockquote>var someProp = \"propName\";<br>var myObj = {<br>  propName: \"Some Value\"<br >}<br>myObj[someProp]; // \"Some Value\"</blockquote>",
 | 
					        "<blockquote>var someProp = \"propName\";<br>var myObj = {<br>  propName: \"Some Value\"<br >}<br>myObj[someProp]; // \"Some Value\"</blockquote>",
 | 
				
			||||||
 | 
					        "Here is one more:",
 | 
				
			||||||
 | 
					        "<blockquote>var myDog = \"Hunter\";<br>var dogs = {<br>  Fido: \"Mutt\",\n  Hunter: \"Doberman\",\n  Snoopie: \"Beagle\"<br >}<br>var breed = dogs[myDog]; // \"Hunter\"<br>console.log(breed)// \"Doberman\"</blockquote>",
 | 
				
			||||||
        "Note that we  do <em>not</em> use quotes around the variable name when using it to access the property because we are using the <em>value</em> of the variable, not the <em>name</em>",
 | 
					        "Note that we  do <em>not</em> use quotes around the variable name when using it to access the property because we are using the <em>value</em> of the variable, not the <em>name</em>",
 | 
				
			||||||
        "<h4>Instructions</h4>",
 | 
					        "<h4>Instructions</h4>",
 | 
				
			||||||
        "Use the <code>playerNumber</code> variable to lookup player <code>16</code> in <code>testObj</code> using bracket notation."
 | 
					        "Use the <code>playerNumber</code> variable to lookup player <code>16</code> in <code>testObj</code> using bracket notation."
 | 
				
			||||||
@@ -3240,7 +3242,7 @@
 | 
				
			|||||||
        "var player = testObj;   // Change this Line"
 | 
					        "var player = testObj;   // Change this Line"
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      "tail": [
 | 
					      "tail": [
 | 
				
			||||||
        ""
 | 
					        "if(typeof player !== \"undefined\"){(function(v){return v;})(player);}"
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      "solutions": [
 | 
					      "solutions": [
 | 
				
			||||||
        "var testObj = {\n  12: \"Namath\",\n  16: \"Montana\",\n  19: \"Unitas\"\n};\nvar playerNumber = 16;\nvar player = testObj[playerNumber];"
 | 
					        "var testObj = {\n  12: \"Namath\",\n  16: \"Montana\",\n  19: \"Unitas\"\n};\nvar playerNumber = 16;\nvar player = testObj[playerNumber];"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user