The instanceof operator tests whether the prototype property of a constructor appears anywhere in the prototype chain of an object.
function Car(make, model, year) {
this.make = make;
this.model = model;
this.year = year;
}
const mycar = new Car('Honda', 'Accord', 1998);
mycar instanceof Car;
// => true
mycar instanceof Object;
// => true