callback

Estimated reading time: 1 minute

Callbacks are a way to make sure certain code doesn’t execute until other code has already finished execution.

  • callback is function which run inside a function
  • callback retrive data which data can use others function.
users = (name) => {
  console.log(`this is ${name}`);
}
account = (callback) => {
  let name = 'kamal';
  callback(name);
}

account(users);

account = (callback) => {
    let name = 'kamal';
    callback(name);
}
account(name => {
  console.log(name);
})

resource

video

  • https://www.youtube.com/watch?v=Nau-iEEgEoM
  • https://www.youtube.com/watch?v=pTbSfCT42_M
js