└── readme.md
/readme.md:
--------------------------------------------------------------------------------
1 | ## Task - 1
2 |
3 | 1a) Write a function that displays a message after 5s.
4 |
5 |
6 |
7 | 1b) Write a function called delayedGreeting() that takes two parameters, name and delay time, and logs a greeting message after the given delay time.
8 |
9 | **Input:**
10 |
11 | delayGreeting(‘Alice’, 2000)
12 |
13 | **Output:**
14 |
15 | Hello, Alice!
16 |
17 | ---
18 |
19 | ## Task - 2
20 |
21 | The function tellJoke() below logs a funny message every 2 seconds and after 10 seconds, it stops. `Complete the code below and see the output`.
22 |
23 | function tellJoke() {
24 | console.log("Why don't scientists trust atoms? Because they make up
25 | everything!");
26 | }
27 |
28 | const jokeInterval = setInterval(?, ?);
29 |
30 | // After 10 seconds, stop telling jokes
31 |
32 | setTimeout(() => {
33 |
34 | //write code
35 |
36 | }, ?);
37 |
38 | ## Task - 3
39 |
40 | Write an `async/await` function that fetch data from an api and logs a message.
41 |
42 | **Input:**
43 |
44 | https://v2.jokeapi.dev/joke/Programming?type=single
45 |
46 |
47 | Note: you can use an api of your choice
48 |
49 |
50 |
51 |
52 | **Output:**
53 |
54 | Two SQL tables sit at the bar. A query approaches and asks "Can I join you?"
55 |
56 |
57 | Note: output may change according to the api you used
58 |
--------------------------------------------------------------------------------