Printing multidimensional arrays

Say I have a multi-dimensional array.


Why does it not print out in this format when I do console.log(arr)? In fact, when I print it, it just shows prints “object”

I will do something like this

let b = [[1,2],[3,4],[5,[6]]];


As @Tchoukoualeu mentioned above, you do need to add the commas in this array.
[[1,2][3,4][5,[6]]] should be [[1,2],[3,4],[5,[6]]].

Aside from that, it’s probably just the FCC test suite. Did you check the browser console to see how it prints there? Do you have a specific example of code we can look at to better answer your question?

If your bidimensional array fits nicely as a matrix/table you can always do console.table()

It still prints the same way even with the commas.

Honestly, I wouldn’t mind working on an IDE with Javascript. I downloaded two of them, but have not taught myself how to use those yet. I should do that pronto so I can avoid spending 2-3 hours on fixing an error that I cannot even see.

You can use JSON.stringify(arr)

For example:

1 Like

you need to use a different console, for example open your browser console and check what gets printed there, the fcc editor console has some limitations. or use a different editor, like (if you want to work in-browser)