Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 567 Bytes

File metadata and controls

21 lines (16 loc) · 567 Bytes

instanceof

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