Console.log a multi-dimensional array Console.log a multi-dimensional array arrays arrays

Console.log a multi-dimensional array


You can use javascript's console.table

This will display your array in table form, making it much more readable and easy to analyse
It is quite a little known feature, however useful when you have a multi-dimentional array.

So, change your code to console.table(items);
It should give you something like this:

 -----------------------|(index)|   0   |   1   ||   0   |   1   |   2   ||   1   |   3   |   4   ||   2   |   5   |   6   | -----------------------


You can use JSON.stringify()

console.log(JSON.stringify(items));

Its output will be like

[[1,2],[3,4],[5,6]]

var items = [[1,2],[3,4],[5,6]];console.log(JSON.stringify(items));