Difference between callback function and lambda function?

Tell us what’s happening:
First see this :-1:

When the functions are passed in to another function or returned from another function, then those functions which gets passed in or returned can be called a lambda

Callbacks are the functions that are slipped or passed into another function to decide the invocation of that function.

Now, callback function are functions that are passed as argument to another function
According to definition of lambda functions that is the same case as with callback…

That means I can say a callback function is a lambda function ?
Both are different?

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36.

Link to the challenge:

Lambda function are anonymous functions. Callback can be named or anonymous.
So all lambda functions can be a callback function but not all callback function can be lambda function.


You should take a look at this article:


Going by wikipedia:

In computer programming, an anonymous function ( function literal , lambda abstraction , or lambda expression ) is a function definition that is not bound to an identifier.

or this SO post:

Lambda comes from the Lambda Calculus and refers to anonymous functions in programming.

Unlike Python (where the language itself calls anonymous function lambda), JS doesnt mention anything about lambda function. You can check the specification yourself.
I think arguing about this is a moot point, the distinction (even if there was one) is not a breaking deal.

I dont see anyone going around calling people out if they use parameter/argument, function/method, library/framework interchangeably even though they are not same. IMO its too pedantic.

Coming to your original question:

That means I can say a callback function is a lambda function ?

I’d say “no”, according to the popular definition of lambda.
Callback functions can be bound to an identifier therefore can be a named function too.

can you tell what you mean by bound to identifier?

const someNameForThisFunction = () => {
  /* This anonymous function is bound to  someNameForThisFunction */

JS doesn’t have lambdas according to the strict definition, but because functions are first-class values, they can act in exactly the same way, it makes no difference if they are given a name or not

Bound to an identifier means the function can be referenced. Every function have a .name property. Anonymous functions have "" as .name.


function add10(callback){
  return 10 + callback();
function someFunc(){
  return 5;

Note you can also reference these function inside themselves meaning recursion is possible, but you cannot reference an anonymous function.
The same example with anonymous function:

function add10(callback){
  return 10 + callback();
  return 5;

Notice the empty string in the output, its because the function is not bound to an identifier but is still a callback function.

1 Like