Coding DinerHave a cup of joe!
ExerciseEasy

Promises Pt. 2

typescript-javascript
Prompt

Create a function that returns promise that waits 3 seconds, then resolves to "hello world"

What does Promise.all() do? What happens if one of the promises in it fails?

How can the following function be valid, if the code is just returning 30? Why is it not returning a promise?

async function getNum(): Promise<number> {
  return 30 // why aren't we creating a new promise here?
}

Your notes

Sign in to keep your own notes on this problem.

Sign in