-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtask6.js
More file actions
33 lines (20 loc) · 703 Bytes
/
task6.js
File metadata and controls
33 lines (20 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { sleepTwoSecs } from "./promises.js";
/*
- Create a function that waits 2 seconds, then logs "Step 1" to the console.
- Then waits 2 seconds more and logs "Step 2" to the console.
- Use the sleepTwoSecs() function.
The sleepTwoSecs() function returns a Promise. It fulfills after 2 secs.
It does not have any arguments.
syntax: sleepTwoSecs(): Promise
example: sleepTwoSecs()
- Use the `then` syntax
Goal: Chain Promises sequentially.
Hints:
- https://javascript.info/promise-chaining (first chapter)
Questions:
- What will be happened, if I return a Promise from the then method's
callback function?
*/
const task = () => {
}
task()