Access MultiDimensional Arrays With Indexes
See original GitHub issueChallenge Access MultiDimensional Arrays With Indexes has an issue.
User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36
.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
// Setup
var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];
// Only change code below this line.
var myData = myArray[0][0] + myArray[2][0];
I think the code used to validate the answer in this challenge has a bug. Could you please investigate.
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (4 by maintainers)
Top Results From Across the Web
Access MultiDimensional Arrays With Indexes - GitHub
Access MultiDimensional Arrays With Indexes. One way to think of a multi-dimensional array, is as an array of arrays. When you use brackets...
Read more >Acces Multi-Dimensional Arrays With Indexes - JavaScript
There is no need for you to re-assign a new array to myArray varaible. So you can safely remove the last line. Make...
Read more >Accessing Data Along Multiple Dimensions in an Array
Introduce the indexing and slicing scheme for accessing a multi-dimensional array's contents. We will encounter arrays of varying dimensionalities: # A 0-D ...
Read more >Multi-dimensional array basics - Aptech
Multi-dimensional arrays are indexed in GAUSS the same way that matrices are indexed, using square brackets [] . Scanning above, you can see...
Read more >Two-Dimensional Arrays
Array indices must be of type int and can be a literal, variable, or expression. rating[3][j] = j;. • If an array element...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After reading the above suggestions, I was able to pass the challenge by submitting:
var myData = myArray[2][1];
So as @pranayberry suggested, the instructions should be change to
In the editor, the code should be: // Setup
var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];
// Only change code below this line.
var myData = "Eneter your number (bracket notation) here"
Thanks for your help.
For me, this video explanation helped to figure out why [2][1]: https://youtu.be/9glEVOTrSYo