-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtask4.js
More file actions
29 lines (19 loc) · 727 Bytes
/
task4.js
File metadata and controls
29 lines (19 loc) · 727 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
import { getRandomNumber } from "./promises.js";
/*
- Create a function that logs a random number to the console.
- Use the getRandomNumber function for it.
The getRandomNumber function do not receive any arguments, but it returns a Promise
that fulfills to a random number after a while.
syntax: getRandomNumber(): Promise<number>
example: getRandomNumber()
- use the `then syntax`
Goal: Handle the promise fulfilled value.
Hints:
- https://javascript.info/promise-basics#consumers-then-catch
Questions:
- How can we get back, how can we "unpack" the fulfilled Promise value?
- How would you name the fulfilled value for this particular case?
*/
const task = () => {
}
task()