en.javascript.info/1-js/09-classes/06-instanceof/1-strange-instanceof/task.md
2019-10-24 11:03:21 +02:00

291 B

importance: 5


Strange instanceof

In the code below, why does instanceof return true? We can easily see that a is not created by B().

function A() {}
function B() {}

A.prototype = B.prototype = {};

let a = new A();

*!*
alert( a instanceof B ); // true
*/!*