Typeerror: callback is not a function

The “typeerror: callback is not a function” is an error message that occurs in JavaScript.

This article will help you learn, understand, and fix this error.

Remember that it is crucial to understand the error first before proceeding to the steps to fix it.

So, without further ado, let us start with understanding this error.

What is typeerror: callback is not a function?

As mentioned in our first sentence, typeerror: callback is not a function is an error message that occurs in JavaScript.

This error occurs when a function’s callback argument is given, but the function is called without passing the callback as a parameter.

Here is a sample code that causes this error:

function sample(callback) {
  return callback();


  return callback();

TypeError: callback is not a function

To fix this error, follow the guide below.

Typeerror: callback is not a function – SOLUTION

Fixing the typeerror: callback is not a function may sound frustrating, but it is easy and quick.

See the sample code below to help you fix the error you are facing.

Sample code:

function sample(callback = () => {}){
 return callback();

Aside from the sample code above, you can also fix it using this code:

function sample(callback) {
 return callback();
sample(() => {
  console.log('This is a success!');


This is a success!

If you only want to test a code, use our online JavaScript compiler. In there, you can run JS code online for free.


🗨 Is a callback function a function?

The answer is yes.

A callback() function is a function in JavaScript.

It is a function that is passed to another function as an argument.

It is then invoked from within the external function to complete a task.

🗨 How to add a callback function in JavaScript?

To add a callback function in JavaScript, first you have to pass it to another function as a parameter.

Then, after the task is finished, call it back.

🗨 What is TypeError?

Typeerror is an error in Python that arises when an operation or function is applied to a value of an improper type.

This error indicates that the data type of an object isn’t compatible with the operation or function being used.

🗨 What is Python?

Python is one of the most popular programming languages.

It is used for developing a wide range of applications.

In addition, Python is a high-level programming language that is used by most developers due to its flexibility.


In conclusion, the typeerror: callback is not a function occurs in JavaScript as an error message.

You can solve this error by using the arrow function to define the callback() function, then returning it to the callback() function.

By following the guide above, you will surely solve this error quickly.

That is all for this tutorial, IT source coders!

We hope you have learned a lot from this. Have fun coding!

Thank you for reading! 😊