Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to pass an id to the route of a seprate file react 
Javascript :: Detect external link Click javascript 
Javascript :: javascript tact template 
Javascript :: count all items inside 2nd ul using jquery 
Javascript :: firestore return the content of an aarray Nodejs 
Javascript :: como usar un use state 
Javascript :: xpath cheat sheet using node 
Javascript :: how to make a login form discord.js part 1 
Javascript :: gatsby markdown link blank 
Javascript :: reorder them so that more specific routes come before less specific routes 
Javascript :: carry forward session storage one page to another page in javascript 
Javascript :: 3.4.2. Two Special Characters¶ 
Javascript :: how to toglle button in viewjs 
Javascript :: handlebars.registerHelper is not a function 
Javascript :: add single quote in Innerhtml javascript string 
Javascript :: datatables width issue for less number of columns 
Javascript :: vs code { key to to go brace 
Javascript :: javascript create nodo 
Javascript :: when i send req upload image in node give Error: ENOENT: no such file or directory,ues multer 
Javascript :: create localStorage key + value if not exist 
Javascript :: jquery ui sortable disable child 
Javascript :: how to send address of mathods call of solidaty in node 
Javascript :: google removing javascript from chrome 
Javascript :: make express app object accessible from all project modules 
Javascript :: skipping test suites chai 
Javascript :: video playing 
Javascript :: about react frame 
Javascript :: react js error stackoverflaw 
Javascript :: uppy count files from javascript 
Javascript :: react native controlling device brightness 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =