Another use of bracket notation on objects is to access a property which is stored as the value of a variable. This can be very useful for iterating through an object's properties or when accessing a lookup table.
Here is an example of using a variable to access a property:
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>.
</section>
## Instructions
<sectionid='instructions'>
Use the <code>playerNumber</code> variable to look up player <code>16</code> in <code>testObj</code> using bracket notation. Then assign that name to the <code>player</code> variable.
testString: assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi),'You should not assign the value <code>Montana</code> to the variable <code>player</code> directly.');
testString: assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code),'You should be using the variable <code>playerNumber</code> in your bracket notation');