码迷,mamicode.com
首页 > 移动开发 > 详细

js中 理解 this.initialize.apply ( this, arguments ) 定义对象的方式

时间:2017-02-24 23:34:55      阅读:236      评论:0      收藏:0      [点我收藏+]

标签:cti   com   create   contain   tool   对象   alt   bsp   ges   

var Class = {
create:function() {
return function() {
this.initialize.apply(this, arguments);
};
}
}

var Tool = Class.create();
Tool.prototype = {
initialize: function($container){

this.val = 32;
},
getVal:function(){
return this.val;
},
setVal:function(_val){

this.val = _val;
}
}

 

技术分享

 

js中 理解 this.initialize.apply ( this, arguments ) 定义对象的方式

标签:cti   com   create   contain   tool   对象   alt   bsp   ges   

原文地址:http://www.cnblogs.com/zhujiasheng/p/6440539.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!