up
This commit is contained in:
parent
ab9ab64bd5
commit
97c8f22bbb
289 changed files with 195 additions and 172 deletions
|
@ -0,0 +1,20 @@
|
|||
importance: 5
|
||||
|
||||
---
|
||||
|
||||
# Strange instanceof
|
||||
|
||||
Why `instanceof` below returns `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
|
||||
*/!*
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue