function someAsyncTask(callback){
setTimeout(function(){
callback();
},3000)
}
someAsyncTask(function(){
console.log(“We did some task”)
})
I am not getting how this function is excuted
Okay so in someAsyncTask you are passing a function called which console logs “We did some task”. In function someAsyncTask function in parameters is called callback, now in someAsyncTask setTimeout function is running which calls function callback after 3000 miliseconds
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.