#svelte5
[[In Javascript a promise is an object awaiting the eventual completion or failure of an asynchronous operation]]. ([MDN webdocs source](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises))
Svelte allows you an easy way to await the value of **promises** that goes directly in your markup
>Note: Only the most recent `promise` is considered, meaning you don't have to worry about race conditions.
**Consider:**
```svelte
{#await promise}
<p>...rolling</p>
{:then number}
<p>you rolled a {number}</p>
{:catch error}
<p style="color: red">{error.message}</p>
{/await}
```
>NOTE: if you know that your promise can't reject, you can omit the `catch` block
If you don't wait to show anything until the promise resolves (and you know the promise cannot reject), the code becomes this simple bit:
```svelte
{#await promise then number}
<p>You rolled a {number}</p>
{/await}
```
This way, the `You rolled a {number}` is displayed only when the promise is resolved