How would I get the following object:
[ 'hello everyone!', { testing: 1 }, 'another:', { state: 1 } ]
To print as the following:
hello everyone! { 
    testing: 1 
} another: { 
    state: 1 
}
The objects in the array can be heavily nested.
I use this right now, but feels like it's heavy:
const messages = [ 'hello everyone!', { testing: 1 }, 'another:', { state: 1 } ];
let string = '';
messages.forEach(element => {
    string += ' ';
    if (typeof element === 'string') {
        string += element;
    } else {
        string += util.inspect(element, { showHidden: false, depth: null, compact: false });
    }
});
console.log(string);
Bonus for elegant code.
 
    

 
    