function func(callback, a, b, c) { return callback(a, b, c);}function funAdd(a, b, c) { function callback(a, b, c) { return a + b + c; } return func(callback, a, b, c);}function funMul(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)); //9alert(funMul(x, y, z)); //24
JavaScript 演练(4). 回调函数
TAG: