How to console log objects with circular references in NodeJS?

How to console log objects with circular references in NodeJS?

Do you often encounter the famous object object log whenever you console log an object in NodeJS?

For me, the solution is simple - use JSON.stringify(object) as a way to get the data inside. But what happens if you then get a JSON error - cannot stringify an object with circular references?

Yet more than three years developing exclusively on NodeJS, I now discover a simple yet effective way of getting the results.

console.log(util.inspect(myObject, false, null, true /* enable colors */))

References

https://stackoverflow.com/questions/10729276/how-can-i-get-the-full-object-in-node-jss-console-log-rather-than-object