created by Brian LeRoux & Andrew Lunny. sparodically uncurated by David Trejo.

2016 03 19 weird instanceof

function Test(){}
Test.prototype = null;
var a = new Test();
a instanceof Test; //Uncaught TypeError: Function has non-object prototype 'null' in instanceof check(…)
a instanceof Object; // true WTF?

ref "The instanceof operator tests whether an object has in its prototype chain the prototype property of a constructor."

Fork me on GitHub