Last active
February 5, 2017 01:39
-
-
Save michael-mafi/3fbad3727b04e48382685005db810d43 to your computer and use it in GitHub Desktop.
isPrototypeOf2 function ๐พ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isPrototypeOf(prototype, object){ | |
| if (prototype === null || undefined){ | |
| return 'null or undefined'; | |
| } | |
| var objectPrototype = Object.getPrototypeOf(object); | |
| while(objectPrototype){ | |
| if(prototype === objectPrototype){ | |
| return true; | |
| } | |
| objectPrototype = Object.getPrototypeOf(objectPrototype); | |
| } | |
| return false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment