Created
November 11, 2012 02:58
-
-
Save songxiaofeng1981/4053516 to your computer and use it in GitHub Desktop.
learn javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Class = function () { | |
var klass = function () { | |
this.initialize.apply(this,arguments) //this中没有init,找原型 | |
}; | |
klass.fn = klass.prototype;//todo 污染 | |
return klass; | |
}; | |
var Model = new Class(); //定义类 | |
Model.fn.initialize = function () { | |
this.save = function () {}; | |
};//定义构造函数 | |
var todo = new Model(); | |
console.log(typeof todo.save); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment