instanceof1 Instanceof 는 뭘 보고 확인하는걸까? /** * instanceof 는 뭘 보고 확인하는걸까 * constructor의 prototype 이 해당 객체의 프로토타입 체인에 존재하는지를 보고 확인한다고 한다. */ function Person(name) { this.name = name; } Person.prototype.person = function() { console.log("person!!"); } function Test() { } Test.prototype.test = function() { console.log("test!"); } var person1 = new Person("Philp"); console.log(person1 instanceof Person); // true console.log(Person.prototype.. 2021. 6. 12. 이전 1 다음