DEV Community

Discussion on: Async First!

Collapse
 
negue profile image
negue

If you only have one await , and don't do anything after that await, you can just omit async / await inside the method.

then it would look like this:

function getPromise(){
  // stuff before
  const neededSomething = 42;
  return getSomethingThatReturnsOnlyPromises(neededSomething);   
}

// the method that uses  getPromise

const something = await getPromise();