更新时间:2021-11-21 22:52:13
这是您想要的:
function alpha(a, b, fn) {
console.log(a, b, a + b);
fn();
}
alpha(5, 10, () => {
console.log("hello");
});
// or defined by default
function alpha2(a, b, fn = () => {
console.log("hello");
}) {
console.log(a, b, a + b);
fn();
}
alpha2(5, 10);