编写node.js的代码时常常写Comment.prototype.save=function(callback){....},这个的意义是是什么,这里总结一下!!
写了一个demo
//测试prototype的功能:下面程序的结果是:
var User = function (){
this.save=function(){
console.log('This is this.save');
}
};
User.save = function () {console.log('This is User.save')};
User.prototype.save = function () {
console.log('This is User.prototype.save')
};
var u = new U