question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Access MultiDimensional Arrays With Indexes

See original GitHub issue

Challenge 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:closed
  • Created 7 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
bricedjilocommented, May 9, 2016

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

Using bracket notation select an element from myArray such that myData is equal to 8.

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.

3reactions
aleksayaroshrenkocommented, May 22, 2017

For me, this video explanation helped to figure out why [2][1]: https://youtu.be/9glEVOTrSYo

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found