以下是类的代码:
1 var Functions = { 2 oFunctions: null, 3 add: function (oFunc, oNewFunc) { 4 var oNew = function () { 5 oFunc(); 6 oNewFunc(); 7 }; 8 return oNew; 9 } 10 };
以下是测试代码:
1 function one() { 2 alert(1); 3 } 4 5 function two() { 6 alert(2); 7 } 8 9 one = Functions.add(one, two); 10 one();