If you want something slightly more general, you can use the arguments variable like so:
(如果您想要更一般的东西,可以使用arguments变量,如下所示:)
function tryMe (param1, param2) {
alert(param1 + " and " + param2);
}
function callbackTester (callback) {
callback (arguments[1], arguments[2]);
}
callbackTester (tryMe, "hello", "goodbye");
But otherwise, your example works fine (arguments[0] can be used in place of callback in the tester)
(但是否则,您的示例可以正常工作(可以在测试器中使用arguments [0]代替回调))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…