Callback Function Is Not Working In Javascript Example
What's wrong in the following callback function example? I am passing some parameters and in the end, I am passing a function that must automatically run when the other tasks are d
Solution 1:
Here is what you want:
functionalpha(a, b, fn) {
console.log(a, b, a + b);
fn();
}
alpha(5, 10, () => {
console.log("hello");
});
// or defined by defaultfunctionalpha2(a, b, fn = () => {
console.log("hello");
}) {
console.log(a, b, a + b);
fn();
}
alpha2(5, 10);
Post a Comment for "Callback Function Is Not Working In Javascript Example"