var func = function (callback, a, b, c) { return callback(a, b, c); } var funAdd = function (a, b, c) { function callback(a, b, c) { return a + b + c; } return func(callback, a, b, c); } var funMul = function (a, b, c) { function callback(a, b, c) { return a * b * c; } return func(callback, a, b, c); } var x = 2, y = 3, z = 4; alert(funAdd(x, y, z)); //9 alert(funMul(x, y, z)); //24 alert(func(funAdd, x, y, z)); //9 alert(func(funMul, x, y, z)); //24
发表回复