Why doesn't console.table() work for all objects/arrays?
I'm currently working on the same exercise for JS30 and encountered the same problem as you, which led me here.
I consulted the console.table() page on MDN, and after doing some testing it appears that this might be a Chrome issue.
From my limited testing, it seems like Chrome doesn't output a table for collections of primitive types (array of strings, single object), only collections of compound types (array of arrays/objects, object whose properties are objects).
This doesn't work:
console.table(['1','2','3']);
But this does:
console.table([['1','2','3']]);
I also tested on Canary, but had the same results.
However on Firefox, console.table()
seems to work correctly. The MDN examples of collections of primitive types worked on Firefox, but not on Chrome.
To have an output on Chrome for your example, what you could do is put the transportation variable inside its own array, so that Chrome will print the table.
console.table([transportation]);