Skip to content

Instantly share code, notes, and snippets.

View NikoEscobar's full-sized avatar
🐺
<Lobo /> Game Dev

Níko Escobar NikoEscobar

🐺
<Lobo /> Game Dev
  • @CrystalGameStd;
  • Brazil - SP
View GitHub Profile
@fdaciuk
fdaciuk / How to use async await without try-catch block.md
Last active April 22, 2024 14:31
How to use async/await without try/catch block

How to use async/await without try/catch block

We can use something like this:

async function resolveToNumber () {
  const promise = Promise.resolve(1)
  const [error, result] = await to(promise)
  console.log(error, result) // [null, 1] -> Here we have the result, and error will be null
}