javascript async await returns undefined

Solutions on MaxInterview for javascript async await returns undefined by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "javascript async await returns undefined"
Damián
05 Jan 2020
1async function getLikes() {
2  const likes = await db.get('myLikes'); // this db method returns a Promise
3  // ...
4  return likes; // will return a Promise resolving likes from db or an error if there is one
5}
6
7async function logLikes() {
8  const result = await getLikes();
9  console.log(result);
10}
11