Glossary
Callback function

Callback function

A callback function is a function that is passed as an argument to another function and executed upon completing the latter’s task. 

In programming, developers use callback functions to carry out another function when specific predetermined conditions — such as task completion, data arrival, or error occurrences — exist. 

Programming languages such as JavaScript and Python use callback functions. JavaScript uses them in event handling, like when a user clicks a button and calls a function to execute a specific task, such as updating the contents of a website. The program executes the callback function once the task is complete. Python uses callbacks in libraries and frameworks like Flask to complete a function after processing a request.

Callback functions allow developers to control the flow of execution to create more efficient and flexible programs. They enable developers to run specific tasks while the program continues to run and initiate other operations upon completion of the task.

Other glossary terms