mirror of
https://github.com/flynx/Course-JavaScript.git
synced 2025-10-29 02:50:09 +00:00
minor cleanup and corner cases illustrated...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
c3d57ce9a8
commit
e2c5bff393
24
js-oop.js
24
js-oop.js
@ -385,6 +385,7 @@
|
||||
: isInstanceOf(obj.__proto__, proto)))
|
||||
}
|
||||
|
||||
|
||||
isInstanceOf(c, C) // -> true
|
||||
isInstanceOf(c, B) // -> true
|
||||
isInstanceOf(c, A) // -> true
|
||||
@ -393,6 +394,29 @@
|
||||
|
||||
isInstanceOf(c, function X(){})
|
||||
// -> false
|
||||
|
||||
|
||||
// Also take note of the following cases:
|
||||
|
||||
Object instanceof Function
|
||||
// -> true
|
||||
Function instanceof Object
|
||||
// -> true
|
||||
Object instanceof Object
|
||||
// -> true
|
||||
Function instanceof Function
|
||||
// -> true
|
||||
|
||||
|
||||
// Now, the fact that a function object is both a function and an object
|
||||
// should be obvious:
|
||||
|
||||
function f(){}
|
||||
|
||||
f instanceof Function
|
||||
// -> true
|
||||
f instanceof Object
|
||||
// -> true
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user