var Class = {
    create: function () {
        return function () {
            this.initialize.apply(this, arguments);
        };
    }
};
Object.extend = function (a, c) {
    for (var b in c) {
        a[b] = c[b];
    }
    return a;
};var Client = OtherClient;
Client = Class.create();
Object.extend(Client.prototype, {
    name: "Hotel",
    InDays: 20,
    afterDays: 180
});这种写法是什么意思???

解决方案 »

  1.   


    var Class = {
                create: function() {
                    return function() {
                        this.initialize.apply(this, arguments);
                    };
                }
            };
            Object.extend = function(a, c) {
                for (var b in c) {
                    a[b] = c[b];
                }
                return a;
            };
              
            var Client = Class.create();
            Object.extend(Client.prototype, {
                name: "Hotel",
                InDays: 20,
                afterDays: 180
            });
            alert(Client.prototype.name); //弹出Hotel
      

  2.   

    这样写有什么好处,用来让object有继承功能??
      

  3.   

    类似java的包,如class.create可以访问它里面的方法。可以是多个方法。