面向对象之prototype,__proto__
2016-06-02 16:16
218 查看
var person = function(name) { this.name = name }; person.prototype.getName = function() { return this.name; } var zjh = new person('zhangjiahao'); zjh.getName(); //zhangjiahao console.log("zjh.__proto__:"); console.log(zjh.__proto__); console.log("person.prototype:"); console.log(person.prototype); console.log("person.__proto__:"); console.log(person.__proto__); console.log("Function.prototype:"); console.log(Function.prototype); console.log("Function.__proto__:"); console.log(Function.__proto__); console.log("Object.prototype:"); console.log(Object.prototype); console.log("Object.__proto__:"); console.log(Object.__proto__);
Object.prototype.__proto__ = null; //这是终点
__proto__指向的是构建者的prototype,它构成连接了原型链。
函数对象的prototype是个对象,里面有构造函数等,可克隆其他对象的方法。
原型链参考文章:http://blog.csdn.net/chunqiuwei/article/details/22872325
相关文章推荐
- POJ 2728 Desert King 01分数规划,最优比率生成树
- 欢迎使用CSDN-markdown编辑器
- Centos5.8下搭建svn
- HTC VIVE开发初体验
- can't login openstack dashboard
- setserial 命令使用
- setfacl权限
- 排序--选择排序
- Jquery和JS获取ul中li标签的实现方法
- WPF中如何为ItemsControl添加ScrollViewer并显示ScrollBar
- mysql 手动安装
- 第二阶段个人总结06
- c++--实参和形参
- Linux CentOS6环境下MySQL5.1升级至MySQL5.5版本过程
- How to terminate console on serial port (UART)
- 变相实现textarea文本域
- 买书方案01
- iOS开发UI篇—使用storyboard创建导航控制器以及控制器的生命周期
- sencha 为panel 注册点击事件
- 二叉树 --->树