Answers for "simple callback pattern"

0

simple callback pattern

const add = (a, b, callback) => {
  setTimeout(() => {
    callback(a + b)
  }, 2000)
}

add(2, 3, (sum) => {
  console.log(sum) // should output 5 after 2 seconds
})
Posted by: Guest on May-21-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language