类的原型对象及链式操作

var Check = function() {};

Check .prototype = {

 checkName: function() {

         return this; //返回当前对象,方便调用

},

 checkPassword: function() {

         return this;

},

 checkAddress: function() {

         return this;

}

}

var check = new Check();

check.checkName().checkPassword().checkAddress()

此时:check.__proto__ === Check.prototype

Object {checkName: function, checkPassword: function, checkAddress: function}

你可能感兴趣的:(前端系列学习,JS原型)