Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript async await returns undefined

async function getLikes() {
  const likes = await db.get('myLikes'); // this db method returns a Promise
  // ...
  return likes; // will return a Promise resolving likes from db or an error if there is one
}

async function logLikes() {
  const result = await getLikes();
  console.log(result);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #async #await #returns #undefined
ADD COMMENT
Topic
Name
6+9 =