Closed
Description
Looks like a Node.js bug. Logging an object should never crash. The same works in the browser:
function X () {}
X.prototype = null;
x = {};
x.constructor = X;
console.log(x);
Node.js:
Uncaught TypeError: Function has non-object prototype 'null' in instanceof check
at Function.[Symbol.hasInstance] (<anonymous>)
at getConstructorName (internal/util/inspect.js:535:13)
at formatRaw (internal/util/inspect.js:803:23)
at formatValue (internal/util/inspect.js:793:10)
at inspect (internal/util/inspect.js:326:10)
at formatWithOptionsInternal (internal/util/inspect.js:1994:40)
at formatWithOptions (internal/util/inspect.js:1878:10)
at Object.value (internal/console/constructor.js:306:14)
at Object.log (internal/console/constructor.js:341:61)
Browser:
{constructor: ƒ}
node Verison: v14.14.0