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

时间:2023-03-09 05:54:21
理解 this.initialize.apply ( this, arguments )定义对象的一种方式
var Class = {
    create:function() {
        return function() {
           this.initialize.apply(this, arguments);
        };
    }
}

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

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

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

相关文章