Array[2] returns value, but array[3] returns [[[OBJECT]]]. Why is this?

Why does console.log(myNestedArray[2]) return the value, but console.log(myNestedArray[3]) return [[[ Object ]]]?

  **Your code so far**
let myNestedArray = [
// Only change code below this line
['unshift', false, 1, 2, 3, 'complex', 'nested'],
  [['deep', 'shift', 6, 7, 1000, 'method']],
    [[['deeper', false, true, 'spread', 'array']]],
      [[[['deepest', 1327.98, 'splice', 'slice', 'push']]]]     
// ['iterate', 1.3849, 7, '8.4876', 'arbitrary', 'depth']
// Only change code above this line


  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15

Challenge: Create complex multi-dimensional arrays

Link to the challenge:

It’s really going to depend on the flavor of JS and the dev tools being used. A decision has to be made about how much to show. If it is too much, it will “short hand” it. Just saying, “OK, it’s of type Object, but it is too big to show here.”

If you must see it, you can convert it to a string with:


or to format it:

console.log(JSON.stringify(myNestedArray[3], null, 2))
1 Like

This is a fantastic answer. Thank you so much for the help

1 Like

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