Access Multi-Dimensional Arrays With Indexes

This commit is contained in:
Abhisek Pattnaik
2015-12-25 23:59:05 +05:30
committed by SaintPeter
parent 058c061262
commit 3b98f1f339

View File

@ -1523,12 +1523,8 @@
"id": "56592a60ddddeae28f7aa8e1", "id": "56592a60ddddeae28f7aa8e1",
"title": "Access Multi-Dimensional Arrays With Indexes", "title": "Access Multi-Dimensional Arrays With Indexes",
"description": [ "description": [
"One way to think of a <dfn>multi-dimensional</dfn> array, is as an <em>array of arrays</em>. When you use brackets to access your array, the first set of bracket refers to the outer-most array, and each subsequent level of brackets refers to the next level in.", "One way to think of a <dfn>multi-dimensional</dfn> array, is as an <em>array of arrays</em>. When you use brackets to access your array, the first set of bracket refers to the entries in outer-most array, and each subsequent level of brackets refers to the next level of entry in.",
"For example:", "<strong>Example:</strong><blockquote>var arr = [<br> [1,2,3],<br> [4,5,6],<br> [7,8,9],<br> [[10,11,12], 13, 14]<br>];<br><code>arr[0]; // equals [1,2,3]</code><br><code>arr[1][2]; // equals 6</code><br><code>arr[3][0][1]; // equals 11</code></blockquote>",
"<pre>var arr = [<br /> [1,2,3],<br /> [4,5,6], <br /> [7,8,9], <br /> [[10,11,12], 13, 14]<br /> ];</pre>",
"<code>arr[0]; // equals [1,2,3]</code>",
"<code>arr[1][2]; // equals 6</code>",
"<code>arr[3][0][1]; // equals 11</code>",
"<h4>Instructions</h4>", "<h4>Instructions</h4>",
"Read from <code>myArray</code> using bracket notation so that myData is equal to <code>8</code>" "Read from <code>myArray</code> using bracket notation so that myData is equal to <code>8</code>"
], ],
@ -1538,7 +1534,7 @@
], ],
"challengeSeed": [ "challengeSeed": [
"// Setup", "// Setup",
"var myArray = [[1,2,3],[4,5,6], [7,8,9], [[10,11,12], 13, 14]];", "var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];",
"", "",
"// Only change code below this line.", "// Only change code below this line.",
"var myData = myArray[0][0];", "var myData = myArray[0][0];",