Skip to content

Commit 464250e

Browse files
question on promise
1 parent dedfbd9 commit 464250e

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

code-snippets/promises.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,38 @@ examplePromise
217217

218218
---
219219

220+
<li>
221+
222+
**What is the output?**
223+
224+
```JS
225+
new Promise((resolve, reject) => {
226+
console.log(4)
227+
resolve(5)
228+
console.log(6)
229+
}).then(() => console.log(7))
230+
.catch(() => console.log(8))
231+
.then(() => console.log(9))
232+
.catch(() => console.log(10))
233+
.then(() => console.log(11))
234+
.then(console.log)
235+
.finally(() => console.log(12))
236+
```
237+
238+
- A: `4 6 7 9 11 12`
239+
- B: `4 6 7 9 11 undefined 12`
240+
- C: `4 6 8 12`
241+
242+
<br/>
243+
<details>
244+
<summary><b>Answer</b></summary>
245+
<p>
246+
247+
#### Option: B
248+
249+
</p>
250+
</details>
251+
</li>
252+
253+
220254
</ol>

0 commit comments

Comments
 (0)