instanceof

    [mdn, 드림코딩 외] 객체지향 (5) : instanceOf 연산자

    instanceOf 연산자(operator) instanceOf 연산자는 생성자의 프로토타입 속성이 객체의 프로토타입 체인에 존재하는지 판별하여 true 나 false를 뱉는다. class Goodcoder { constructor(age, lang, address) { this.age = age; this.lang = lang; this.address = address; } } const noran = new Goodcoder(20,'Java','Seoul'); console.log(noran instanceof Goodcoder); //true console.log(paran instanceof Goodcoder); //Uncaught ReferenceError: paran is not defined..