DEV Community

Mahin Tazuar
Mahin Tazuar

Posted on

Callback Function

Call back function is very important for us. Because we are need to use this function regularly.
The defination is callback function -
When we are passed a function as a argument in another function. When need to call this function , we can just call this argument , and if it is run correctly as a function that is called callback function.

const getVar = () => {
   setTimeout(function() {
      console.log('A Function that takes some time');
   }, 3000)
}

const printSomething = () => {
   console.log('Another Function');
}

getVar();
printSomething();
Enter fullscreen mode Exit fullscreen mode

Top comments (0)