Callback Functions in JavaScript Explained

Callback Functions in JavaScript Explained

Callback Functions A callback function is a function which is passed as an argument to another function. e.g. function kind(){ console.log("I'm kind"); } function rude(){ console.log("I'm rude"); } function fun(a, b){ a();//calls kind() b();//calls rude() } fun(kind, rude); //Output: I'm kind I'm rude Here, kind and rude are callback functions because they are passed as arguments to another function named as fun. And fun is called a...

Original Source

Read the full article at Dev →

KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.