Guest User

Untitled

a guest
Jun 24th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. function instanceOf (obj, className) {
  2. if (isPrimitive(obj)) return false
  3. if (
  4. obj.constructor &&
  5. obj.constructor.name === className
  6. ) {
  7. return true
  8. }
  9.  
  10. let prototype = Object.getPrototypeOf(obj)
  11.  
  12. return instanceOf(prototype, className)
  13. }
Add Comment
Please, Sign In to add comment