To print an array in JavaScript, do this:
console.log(JSON.stringify(array))
.Here's how you do it:
const array = [
12,
'Hello World!',
{ an: 'object' },
[ 'nested array' ]
];
const printed = JSON.stringify(array);
// [12,"Hello World!",{"an":"object"},["nested array"]]
console.log(printed);