Sub array clarification

Tell us what’s happening:
I understand how to do the problem. I just want to know where this multi-dimensional array contains the 7 sub arrays. Like how do I make sure I understand where we are getting the several sub arrays? Do we literally count the brackets, strings, commas, and numbers? Hopefully, I am making this understandable. I may look too far into things, but I truly want to wrap my head around it and know why we say there are several sub arrays here.
Your code so far

var myList = [
["ice cream", 2],
["bread", 1],
["frozen dinner", 8],
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36.

Challenge: Shopping List

Link to the challenge:

Hi @gabora94 !

I count 5 sub arrays in the myList array.

Hmm, that is odd that it let me pass the lesson. So technically this is not several which would mean this should not be correct?

would this be considered several then?

var myList = [
  ["salsa", 3],

That would be seven sub arrays.

I haven’t looked at the tests for the challenge but maybe they are accepting an array of at least 5 sub arrays.

Edit: I just read the instructions and it says at least 5 so your answer is correct.

FCC instructions:There should be at least 5 sub-arrays in the list.

Oh ok. I’m sorry I did not see that. But thanks for clarifying everything.

There are commands that you can use in JavaScript that will tell you how many elements are in an array, whether those are also arrays and so on. But if you’re talking about having multidimensional arrays in a human readable format, we mostly do that with indentation.

let someArray = [
    [ 1, 3, 0,5, 7],
        ["A", "r", "i", "e", "l"],
        ["L", "e", "s", "l", "i", "e"]

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