<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script>
/*级联函数重点在于 把当前原型对象指针返回, 即可调用其他方法*/
function person() {
this._lian = "";
this._zui = "";
this._tui = "";
}
person.prototype = {
setLian: function() {
this._lian = "大脸";
return this;
},
setZui: function() {
this._zui = "大嘴";
return this;
},
setTui: function() {
this._tui = "大腿";
return this;
}
}
var p = new person();
p.setLian().setZui().setTui();
console.log(p);
</script>
</head>
<body>
</body>
</html>
原文:http://www.cnblogs.com/yqlog/p/5557425.html