6. Arrays of arrays. Any way to access the 2nd tier specific value?


Is there any way to access a second or third degree specific array value?

This is the lesson I was working on when I though of this question.

var newArray = [
   ["Demonbaby", "Junior", "Slice"],
   [666, 69, 13],
   ["Candy", "Murder", "Torture"]];

console.log (newArray[0]);

I want to log "Demonbaby" to the console. Any way to access just that one value of the second tier array?


I believe that you can use:



Nope, that calls the entirety of the array located at the final term of the address located:


will only recall the FINAL term in the address. Not sure what the previous terms do, but I'm just looking for the first position in the first array.
Any other ideas?


In a multi-dimension list, we have a list of lists. We can think of it as a grid-like array, but it is still linear.

var array = [];
array.push(['first row", 'second element']);
array.push(['second row', 'second element']);
array.push(['third row', 'second element']);

console.log(array[0][1]);    // second element

console.log(array[1][0]);    // second row


AHHHHH!!! You again! Amazing! Thanks. That was going to bug me for days.


Interesting. As with everything unknown, google it!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.