Skip to content

Instantly share code, notes, and snippets.

@raiandexter0607
Last active November 25, 2022 21:35
Show Gist options
  • Save raiandexter0607/7f3980ebf6adc448fbb570877819a05f to your computer and use it in GitHub Desktop.
Save raiandexter0607/7f3980ebf6adc448fbb570877819a05f to your computer and use it in GitHub Desktop.
asyncronism with callbacks
const sum = function (num1, num2) {
console.log(num1 + num2);
}
const sumNumbers = function (callback) {
console.log('Summing numbers...');
setTimeout(() => {
callback(5, 10);
}, 1000)
}
sumNumbers(sum);
console.log('holi')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment