Skip to content

ProgrammingHero1/more-js-concepts-tasks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Task - 1

1a) Write a function that displays a message after 5s.


1b) Write a function called delayedGreeting() that takes two parameters, name and delay time, and logs a greeting message after the given delay time.

Input:
delayGreeting(‘Alice’, 2000)

Output:
Hello, Alice!


Task - 2

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.

    function tellJoke() {
     console.log("Why don't scientists trust atoms? Because they make up
     everything!");
    }

    const jokeInterval = setInterval(?, ?);

    // After 10 seconds, stop telling jokes

    setTimeout(() => {

     //write code

    }, ?);

Task - 3

Write an async/await function that fetch data from an api and logs a message.

Input:
https://v2.jokeapi.dev/joke/Programming?type=single


Note: you can use an api of your choice

Output:
Two SQL tables sit at the bar. A query approaches and asks "Can I join you?"


Note: output may change according to the api you used

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published