Chapter quiz · Functions

Test what you learned.

8 questions on Functions. Pass 70% to clear the chapter.

← Review chapter lessons

Quiz

Functions — Chapter Quiz

Eight questions on function declarations, parameters, arrows, scope, closures, this.

0/ 10
  1. Question 1
    1

    Which is the most important difference between a function declaration and a function expression?

  2. Question 2
    2

    What does this code log?

    function add(a, b = a) {
      return a + b;
    }
    console.log(add(5));
    
  3. Question 3
    3

    What does this code log?

    function sum(...nums) {
      return nums.length;
    }
    console.log(sum(1, 2, 3, 4));
    
  4. Question 4
    4

    An arrow function gets its own this, separate from the surrounding scope.

  5. Question 5
    5

    After for (var i = 0; i < 3; i++) setTimeout(() => console.log(i));, what gets logged?

  6. Question 6
    6

    What does this code log?

    const user = {
      name: "Ada",
      greet() {
        return `Hi, ${this.name}`;
      },
    };
    const fn = user.greet;
    console.log(fn?.());
    
  7. Question 7
    7

    What does .bind(obj) do to a function?

  8. Question 8
    8

    A function that takes another function as an argument or returns a function is called a _________ function.

Pick an answer — instant feedback as you go.