prototype
来源:互联网 发布:淘宝直通车使用教程 编辑:程序博客网 时间:2024/05/17 12:52
//创建类
function C(name,sex){
this.name=name;
this.sex=sex;
this.fun=function(){
alert(this.sex);
}
}
C.prototype.fun2=function(){
alert('fun2');
}
//实例化对象
var cobj=new C('ht','男');
//访问属性;
alert(cobj.name);
//访问方法
cobj.fun();
cobj.fun2();
function C(name,sex){
this.name=name;
this.sex=sex;
this.fun=function(){
alert(this.sex);
}
}
C.prototype.fun2=function(){
alert('fun2');
}
//实例化对象
var cobj=new C('ht','男');
//访问属性;
alert(cobj.name);
//访问方法
cobj.fun();
cobj.fun2();
0 0
- Prototype
- ProtoType
- prototype
- prototype
- Prototype
- prototype
- Prototype
- Prototype
- Prototype
- prototype
- prototype
- prototype
- prototype
- prototype!
- Prototype
- prototype
- prototype
- prototype
- 《Python学习手册》读书笔记
- 一个对话框类的Applet程序
- 怎么提升自己做项目能力
- Vim环境配置 for ACM C++
- 安卓linux uevent内核上报机制实例
- prototype
- 设置导航栏的相同的返回按钮图片,相同的字体和相同的背景色
- 对象的转型_21
- a和&a有什么区别
- JAVA复习笔记--------类(一)概述
- iOS crash bug 定位
- 疑掠伟庞屹飞妓坏人蹬
- root密码丢失解决方法
- 寻找数组中最大值