You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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: