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

20 lines
291 B
Markdown

importance: 5
---
# Strange instanceof
In the code below, why does `instanceof` return `true`? We can easily see that `a` is not created by `B()`.
```js run
function A() {}
function B() {}
A.prototype = B.prototype = {};
let a = new A();
*!*
alert( a instanceof B ); // true
*/!*
```