zoukankan
html css js c++ java
prototype理解
<
script
>
function
aa()
{
this
.x
=
5
;
this
.y
=
6
;
//
内部定义的函数只有实例化后才可以使用
this
.test
=
function
(a)
{
alert(a
+
"
,
"
+
this
.x
+
"
,
"
+
this
.y);
}
}
//
prototype定义的函数未实例化就可以取得指针
aa.prototype.pany
=
function
(a)
{
alert(a
+
"
,
"
+
this
.x);
}
alert(aa.test);
alert(aa.prototype.test);
alert(aa.pany);
alert(aa.prototype.pany);
window[
"
Hello
"
]
=
aa;
aa.prototype[
"
MyAlert
"
]
=
aa.prototype.pany;
var
xx
=
new
Hello();
xx.MyAlert(
"
0
"
);
xx.pany(
"
1
"
);
//
xx.test(
"
2
"
);
</
script
>
查看全文
相关阅读:
单例模式 & Init(allocWithZone:)
Go 初体验
Go 初体验
beego 初体验
beego 初体验
beego 初体验
beego 初体验
beego 初体验
beego 初体验
beego 初体验
原文地址:https://www.cnblogs.com/panyee/p/386984.html
最新文章
106.正则表达式
105.格式化文件xml与json
104.协程
103.多进程
102.多线程
101.logging
XML 增、删、改
messageBox 的几种显示方式
根据指定日期获取所在月份日期列表及根据时间范围获取月份列表
根据时间段获取时间段内所有时间点(js)
热门文章
Web Service 的工作原理
sp_executesql介绍和使用
Row_number 详解
移除数组中某个数组对象
动态加载图片
.net(C#)常见面试题
深拷贝和浅拷贝(copy & mutableCopy)
宏定义中#与##
如何修改API中方法?
静态变量-static关键词
Copyright © 2011-2022 走看看