en.javascript.info/1-js/07-object-oriented-programming/11-instanceof/1-strange-instanceof/task.md
Ilya Kantor 97c8f22bbb up
2017-03-21 17:14:05 +03:00

274 B

importance: 5


Strange instanceof

Why instanceof below returns 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
*/!*