Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function instanceOf (obj, className) {
- if (isPrimitive(obj)) return false
- if (
- obj.constructor &&
- obj.constructor.name === className
- ) {
- return true
- }
- let prototype = Object.getPrototypeOf(obj)
- return instanceOf(prototype, className)
- }
Add Comment
Please, Sign In to add comment