Day 10 of 120-days fullstack software development. Call back function:- Well basically this is used when we want to perform another function inside a function,
this function is passed as an argument to another function then executed inside the function. E.g like in the case of a map() function/method pin which receives a function that loops through maybe an array and performs a task that modifies the array and returns a new modified array.
Here's the syntax of how it works:
You define a main/parent function that takes another function as a parameter.
Inside the body of the main function you can perform any task you want and also inside the body of the main function you call/run the callback function, then the callback function runs and it's executed after the main task.
Callback function is actually used when something will not end immediately like in asynchronous operations.
In modern programming currently promises and async/await is preferred and a more cleaner ways for handling operations that are not expected to finish immediately.
Last updated: October 24, 2025
Written by: Martins John Okafor
Tags:
#tech
#coding
#programming
#JavaScript
#callBackFunction