90. write your own `instanceof`

medium  - accepted / - tried

Do you know how instanceOf works ?

If so, please write you own myInstanceOf().

class A {}
class B extends A {}

const b = new B()
myInstanceOf(b, B) // true
myInstanceOf(b, A) // true
myInstanceOf(b, Object) // true

function C() {}
myInstanceOf(b, C) // false
C.prototype = B.prototype
myInstanceOf(b, C) // true
C.prototype = {}
myInstanceOf(b, C) // false

Think about the edge cases.

(51)