Merge pull request #5595 from abhisekp/fix/object-lookup

Fix Using Objects for Lookups description
This commit is contained in:
Logan Tegman
2015-12-30 16:36:57 -08:00

View File

@ -3544,7 +3544,7 @@
"description": [ "description": [
"Objects can be thought of as a key/value storage, like a dictonary. If you have tabular data, you can use an object to \"lookup\" values rather than a <code>switch</code> statement or an <code>if/else</code> chain. This is most useful when you know that your input data is limited to a certain range.", "Objects can be thought of as a key/value storage, like a dictonary. If you have tabular data, you can use an object to \"lookup\" values rather than a <code>switch</code> statement or an <code>if/else</code> chain. This is most useful when you know that your input data is limited to a certain range.",
"Here is an example of a simple reverse alphabet lookup:", "Here is an example of a simple reverse alphabet lookup:",
"<blockquote>var alpha = {<br> 1:\"Z\",<br> 2:\"Y\",<br> 3:\"X\",<br>...<br> 4:\"W\",<br> 24:\"C\",<br> 25:\"B\",<br> 26:\"A\"<br>};<br>alpha[2]; // \"Y\"<br>alpha[24]; // \"C\"</blockquote>", "<blockquote>var alpha = {<br> 1:\"Z\",<br> 2:\"Y\",<br> 3:\"X\",<br> 4:\"W\",<br> ...<br> 24:\"C\",<br> 25:\"B\",<br> 26:\"A\"<br>};<br>alpha[2]; // \"Y\"<br>alpha[24]; // \"C\"</blockquote>",
"<h4>Instructions</h4>", "<h4>Instructions</h4>",
"Convert the switch statement into a lookup table called <code>lookup</code>. Use it to lookup <code>val</code> and return the associated string." "Convert the switch statement into a lookup table called <code>lookup</code>. Use it to lookup <code>val</code> and return the associated string."
], ],