Search code examples
functioncallbackfunction-call

what is the difference between a 'function call' and a 'callback function'?


function call

Per MDN, A function call is an expression that passes control and arguments (if any) to a function and has the form: expression (expression-listopt)

callback function

A callback function is a lucky function that gets passed into the enclosing higher-order function: The callback function gets executed (called) inside the higher order function, but not necessarily immediately. https://thenewstack.io/mastering-javascript-callbacks-bind-apply-call/


Solution

  • function call is term related to program syntax. it related to generally programs and programming languages. There are no predefined semantic, just term which used to describe programs.

    callback function is term related to program execution semantic. In some kind callback function is function call with scope, which pass as parameter to another function or method, some parameters of callback function can be free variables and callback function executed generally after method or function in which it was passed.