Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript wait for function to return value

// function to resolve the promise has to be async
async function waitForResult() {
  // using await keyword
  const result = await loadResults();
  console.log(result);
}
 
PREVIOUS NEXT
Tagged: #javascript #wait #function #return
ADD COMMENT
Topic
Name
3+4 =