Merge pull request #8639 from elazzabi/fix/typo-in-accessing-objects-properties-with-variables

Fixing typo in accessing objects proprieties with variables
pull/8647/merge
Mrugesh Mohapatra 2016-05-15 22:21:13 +05:30
commit 10ce97406d
1 changed files with 1 additions and 1 deletions

View File

@ -3971,7 +3971,7 @@
"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>",
"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>",
"<blockquote>var myDog = \"Hunter\";<br>var dogs = {<br> Fido: \"Mutt\",\n Hunter: \"Doberman\",\n Snoopie: \"Beagle\"<br >}<br>var breed = dogs[myDog];<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>",
"<h4>Instructions</h4>",
"Use the <code>playerNumber</code> variable to lookup player <code>16</code> in <code>testObj</code> using bracket notation."