首页 > 编程语言 > 详细

【Javascript问题系列】

时间:2015-04-17 10:55:28      阅读:279      评论:0      收藏:0      [点我收藏+]
 1 function Box(){}
 2 Box.prototype = {
 3     constructor : function (){
 4         console.log(‘this is constructor‘);
 5     },
 6     name : ‘name‘,
 7     age : 25,
 8     run : function (){
 9         return this.name + this.age + ‘running‘;
10     }
11 }
12 var box = new Box();

对Box的原型构造函数重写,为什么创建Box的实例,不会输出 this is constructor 呢~,难道创建实例的时候没有调用原型构造函数么?

【Javascript问题系列】

原文:http://www.cnblogs.com/zydganbatei/p/4434086.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!