Question with callback function

I am confused with this code here:

let add = function(a,b){
   return a+b;
};

let calc = function(num1, num2, callback){
    return callback(num1,num2);
};

console.log(calc(10,3,add));

My question is, when I console.log this why does it log 13 when 10 and 3 is the parameter of calc variable and not the add variable

You are passing the parameters from the calc function to the add function.

When you call calc calc(10,3,add) you are passing in 3 parameters, the two numbers and the function add. So the scope of calc now has access to num1(10), num2(3), and callback(add).

Since you are returning callback(num1, num2) inside of calc, it calls the add function and passes the num parameters.

callback parameter in the code is actually the add function that is being passed .
in the return statement

return  callback(num1,num2) ; 
is actually: 
return add(num1,num2) ; //as callback is add function 

which calls add function and returns num1+num2

Your third parametar is callback function, and when you called it in console log, you’re initilazing it with call to add function. Make another like substract where you return a-b and you’ll get an idea then.