-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Callback Question? #27
Comments
You have a function addTwoArgs, which takes two arguments a and b, along with a third argument callback. The addTwoArgs function checks if the callback is a valid function using typeof and then proceeds to call the callback function passing the arguments a and b. When you call addTwoArgs(2, 5, (a, b) => { return a + b; }), it adds the two arguments 2 and 5 by invoking the callback function (a, b) => { return a + b; }. In this case, the callback function simply adds the two arguments and returns the result. So, the output of console.log(result); will be 7, which is the result of adding 2 and 5 |
I'm kinda confused it says to add two arguments so why do I do this manually in the code below
Awesome-JavaScript-Interviews/Javascript/js-basics/custom_Callback-1.js
Line 45 in 64eaf29
should it be like the code below?
If I am wrong please correct me.
The text was updated successfully, but these errors were encountered: