HasownProperty : 객체에 이름을 준 속성 또는 객체가 있는지 여부를 결정하는 데 사용됩니다. 그러나이 방법은 객체의 프로토 타입 체인 에이 특성을 가지고 있는지 확인할 수 없으며, 이는 객체 자체의 구성원 여야합니다.
ISPROTOTYP : 지정된 객체 인스턴스에 프로토 타입 체인이 존재하는지 여부를 확인하는 객체를 결정하는 데 사용됩니다. 그렇다면 true를 반환하고 그렇지 않으면 false를 반환합니다.
코드 사본은 다음과 같습니다.
함수 siteadmin (별명, siteName) {
this.nickname = 별명;
this.siteName = siteName;
}
siteadmin.prototype.showadmin = function () {
ALERT (this.nickName+"는"+this.siteName+"의 웹 마스터입니다!")
};
siteadmin.prototype.showsite = function (siteUrl) {
this.siteurl = siteUrl;
return this.siteName+"는"+this.siteUrl;
};
var matou = new siteadmin ( "wulin.com", "웹 프론트 엔드 개발");
var matou2 = new siteadmin ( "wulin.com", "웹 프론트 엔드 개발");
matou.age = "30";
// matou.showadmin ();
// ALERT (MATOU.SHOWSITE ( "// www.vevb.com/");
alert (matou.hasownproperty ( "nickname")); // true
alert (matou.hasownproperty ( "age")); // true
ALERT (MATOU.HASOWNPROPERTY ( "showAdmin")); // false
alert (matou.hasownProperty ( "siteUrl")); // false
Alert (siteadmin.prototype.hasownproperty ( "showadmin")); // true
Alert (siteadmin.prototype.hasownproperty ( "siteUrl")); // false
Alert (siteadmin.prototype.isprototypof (matou)) // true
Alert (siteadmin.prototype.isprototypof (matou2)) // true