godaddy网站建设怎么样,网站数据修改教程,阿里云备案个人可以做网站吗,张家口网站建设开发转自#xff1a;http://www.cnblogs.com/jenry/archive/2010/12/08/1900150.html hasOwnProperty#xff1a;是用来判断一个对象是否有你给出名称的属性或对象。不过需要注意的是#xff0c;此方法无法检查该对象的原型链中是否具有该属性#xff0c;该属性必须是对象本身的… 转自http://www.cnblogs.com/jenry/archive/2010/12/08/1900150.html hasOwnProperty是用来判断一个对象是否有你给出名称的属性或对象。不过需要注意的是此方法无法检查该对象的原型链中是否具有该属性该属性必须是对象本身的一个成员。 isPrototypeOf是用来判断要检查其原型链的对象是否存在于指定对象实例中是则返回true否则返回false。 实例try function siteAdmin(nickName,siteName){this.nickNamenickName;this.siteNamesiteName;}siteAdmin.prototype.showAdmin function() {alert(this.nickName是this.siteName的站长!);};siteAdmin.prototype.showSite function(siteUrl) {this.siteUrlsiteUrl;return this.siteName的地址是this.siteUrl;};var matounew siteAdmin(愚人码头,WEB前端开发);var matou2new siteAdmin(愚人码头,WEB前端开发);matou.age30;
// matou.showAdmin();
// alert(matou.showSite(http://www.css88.com/));alert(matou.hasOwnProperty(nickName));//truealert(matou.hasOwnProperty(age));//truealert(matou.hasOwnProperty(showAdmin));//falsealert(matou.hasOwnProperty(siteUrl));//falsealert(siteAdmin.prototype.hasOwnProperty(showAdmin));//truealert(siteAdmin.prototype.hasOwnProperty(siteUrl));//falsealert(siteAdmin.prototype.isPrototypeOf(matou))//truealert(siteAdmin.prototype.isPrototypeOf(matou2))//true 转载于:https://www.cnblogs.com/tv151579/p/3740463.html