Node.js – console.log does not show items in array but instead shows [Object]

It looks like this is an old topic, anyway

I’ve faced the same issue, embedded array printed as [Array].

It is because of console.log in the node.js uses util.inspect for print, the default depth is 2.
So, to print something which is deeper than 2 followings can be used:

const util = require('util')
console.log(util.inspect(errors, true, 10))

Leave a Comment