Skip to content

NoroffFEU/lesson-task-js1-module2-lesson1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

JavaScript 1 - Module 2

Lesson Task 1 Questions

Question 1

Create a function called receivingFunction which accepts one argument. Inside this function check if the argument is a function, and if it is, call the function.

Create another function called callbackFunction which logs the string: "I am a callback function".

Call receivingFunction and pass callbackFunction into it as an argument.

Question 2

Convert the following for loop to a forEach loop.

const prizes = ["Bag of bananas", "Box of frogs", "Car of clowns"];

for (let i = 0; i < prizes.length; i++) {
    console.log(`Prize ${i + 1}: ${prizes[i]}`);
}

Question 3

Write code that waits 5 seconds before logging the string: I waited 5 seconds before executing. Store the amount of seconds (5 initially) in a variable so it can be easily changed.

Question 4

Write code that logs the numbers 1 to 4 every 1.5 seconds and then stops.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages