DEV Community

RADHAKRISHNAN S
RADHAKRISHNAN S

Posted on Edited on

CALLBACK FUNCTION

What's callback function?

"I will call back later!"

A JavaScript callback is a function passed as an argument to another function, which is then executed (or "called back") at a later point in time to complete a specific task.

 function teamIndia(name){
            console.log("Cricket");
            name("Rohitsharma");

        }


        function playGround(player){
            console.log(player + " scored a Century");
        }
        teamIndia(playGround);

Enter fullscreen mode Exit fullscreen mode

OUTPUT: Cricket
Rohitsharma scored a century

Top comments (0)