日期:2014-05-16  浏览次数:20415 次

js新手基础问题2
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
});

这种写法是什么意思???

------解决方案--------------------
JScript code

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