Dev HelpersOpen library
← Back

Inspect circular structures

Inspect circular structures in JavaScript.

Open this example in the interactive library

Source code

import { inspect } from "node:util";
const item = { name: "root" };
item.self = item;
console.log(inspect(item, { colors: false }));

Sample output

<ref *1> { name: 'root', self: [Circular *1] }