- {symbol} that can be used to declare custom inspect functions.
In addition to being accessible through util.inspect.custom, this
symbol is [registered globally][global symbol registry] and can be
accessed in any environment as Symbol.for('nodejs.util.inspect.custom').
const inspect = Symbol.for('nodejs.util.inspect.custom');class Password {constructor(value) {this.value = value;}toString() {return 'xxxxxxxx';}[inspect]() {return `Password <${this.toString()}>`;}}const password = new Password('r0sebud');console.log(password);// Prints Password <xxxxxxxx>
See [Custom inspection functions on Objects][] for more details.
