It seems like you are using an ad blocker. To enhance your experience and support our website, please consider:

  1. Signing in to disable ads on our site.
  2. Sign up if you don't have an account yet.
  3. Or, disable your ad blocker by doing this:
    • Click on the ad blocker icon in your browser's toolbar.
    • Select "Pause on this site" or a similar option for lancecourse.com.

JavaScript Control Structures and Functions Quiz

Test your knowledge of control structures and functions in JavaScript.

Question 1

What keyword is used to define a function in JavaScript?

Question 2

Which of the following statements is used to stop a loop?

Question 3

What does the "break" statement do in a switch case?

Question 4

What does the following code return? function add(a, b) { return a + b; } add(5, 10);

Question 5

What will the following code output? console.log(2 === "2");

Question 6

Which loop will always execute at least once?

Question 7

How are function expressions different from function declarations?

Question 8

Which of the following is a higher-order function?

Question 9

What is the output of the following code? let x = 10; if (x > 5) { var x = 20; } console.log(x);

Question 10

What will be the value of "y" after the following code? let y; if (true) { let y = 5; } console.log(y);