js中的hasOwnProperty和isPrototypeOf方法
来源:互联网 发布:宝信软件 600845 编辑:程序博客网 时间:2024/06/05 18:29
isPrototypeOf是用来判断要检查其原型链的对象是否存在于指定对象实例中,是则返回true,否则返回false。
function siteAdmin(nickName,siteName){
this.nickName=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("愚人码头","WEB前端开发");
var matou2=new siteAdmin("愚人码头","WEB前端开发");
matou.age="30";
// matou.showAdmin();
// alert(matou.showSite("http://www.css88.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.isPrototypeOf(matou))//true
alert(siteAdmin.prototype.isPrototypeOf(matou2))//true
- js中的hasOwnProperty和isPrototypeOf方法
- js中的hasOwnProperty和isPrototypeOf方法
- js中的hasOwnProperty和isPrototypeOf方法
- js中的hasOwnProperty和isPrototypeOf方法
- js中的hasOwnProperty和isPrototypeOf方法
- js中的hasOwnProperty和isPrototypeOf方法
- js中的hasOwnProperty和isPrototypeOf方法
- js中的hasOwnProperty和isPrototypeOf方法使用实例
- js中的hasOwnProperty和isPrototypeOf方法使用实例
- js中的hasOwnProperty和isPrototypeOf方法使用实例
- js中的hasOwnProperty和isPrototypeOf方法使用实例
- js中的hasOwnProperty和isPrototypeOf方法使用实例
- javascript中的hasOwnProperty和isPrototypeOf
- JavaScript中的hasOwnProperty和isPrototypeOf方法使用实例
- javascript中的hasOwnProperty()、propertyIsEnumerable()和isPrototypeOf()
- hasOwnProperty和isPrototypeOf用法
- javascript--hasOwnProperty()+isPrototypeof()+in方法
- JavaScript中的函数hasOwnProperty()和isPrototypeOf()的一些理解
- 第4周实践项目4 - 建设双链表算法库(选做)
- linux dns正反向解析配置
- 第九周项目2-(2)对称矩阵的加法和乘法
- VC++ 6.0实用技巧汇总
- 今天大盘不好,中国高科本来涨上去了,又回来了呵呵。。。
- js中的hasOwnProperty和isPrototypeOf方法
- 64位JAVA环境配置
- UiObject官方文档,个人翻译
- 第十周项目1—二叉树的链式存储及基本运算
- 第九周项目3—稀疏矩阵的三元组表示的实现及应用(2)
- HUD 1026 纯C代码广搜
- 稀疏矩阵的三元组表示的实现(3.1)
- POJ 题目1505 Copying Books(DP,打印路径)
- mysqldump使用方法