<script>
function employee(fname, lname) {
this.fname = fname;
this.lname = lname;
this.fullname = function () {
return this.fname + " " + this.lname;
}
}
employee.prototype.sendtoserver = function () {
$.post("/abc.aspx",this).done(function (data) {
console.log(data);
});
}
var johnny = new employee("johnny", "hkko");
</script>
当我按下按钮时调用原型功能点击这样
<input type="button" onclick="johnny.sendtoserver()" value="fddfdfdf"/>`
达到最大堆栈大小,当我调试时发现它被多次调用,其中一个是johny,另一个是带窗口。