定义、声明的函数
function b() {
console.log(arguments);
}
var b = function (base) {
return function () {
base(arguments);
}
}(b)
拓展原型链上的方法
// 使用lodash遍历Object
var _ = require("lodash");
function b() {
}
b.prototype.add = function () {
console.log(arguments);
}
_.forEach(b.prototype, function(executiveFun, functionName) {
b[functionName] = function (base) {
return function () {
base(arguments);
}
}(b[functionName])
});
var c = new b();
c.add(1,2,3,4);
网友评论