Prototypes & OOP

Implement Custom instanceof

easyJS SpecificJS / TS3 tests

Problem Statement

Implement `myInstanceOf(object, constructor)` that checks if the prototype property of a constructor appears anywhere in the prototype chain of an object.

Examples

Example 1:
class Animal {}
class Dog extends Animal {}
const d = new Dog();
myInstanceOf(d, Dog); // true
myInstanceOf(d, Animal); // true
myInstanceOf(d, Array); // false
JavaScript & TypeScript starter code included
Run this as a live interview

Practice solo

3 test cases. No second person needed.

Get new interview exercises

Practice problems and review drills, sent when we publish new ones. No spam.

Unsubscribe anytime. We never share your address.