-
Notifications
You must be signed in to change notification settings - Fork 0
익숙치 않은 문법
develjsw edited this page Jun 3, 2023
·
6 revisions
특정 객체가 특정 클래스의 인스턴스인지 확인하는 문법
- object instanceof class (JS 문법)
- return type : boolean
ex)
class Person {}
const person = new Person();
console.log(person instanceof Person); // true
console.log(person instanceof Object); // true
const obj = {};
console.log(obj instanceof Person); // false
console.log(obj instanceof Object); // true