JavaScript Tutorial

instanceof Operator

Checks if an object's prototype chain contains the prototype property of a constructor.

class Animal {}
const dog = new Animal();
dog instanceof Animal; // true