Chapter quiz · Objects & Classes

Test what you learned.

8 questions on Objects & Classes. Pass 70% to clear the chapter.

← Review chapter lessons

Quiz

Objects & Classes — Chapter Quiz

Eight questions on object literals, destructuring, classes, prototypes, and collections.

0/ 8
  1. Question 1
    1

    What does this code log?

    const a = { x: 1 };
    const b = { x: 1 };
    console.log(a === b);
    
  2. Question 2
    2

    What does this code log?

    const user = { name: "Ada", age: 36 };
    const { name: who } = user;
    console.log(who);
    
  3. Question 3
    3

    In a subclass constructor, when MUST you call super(...)?

  4. Question 4
    4

    What does this code log?

    class Counter {
      count = 0;
      inc() { this.count++; }
    }
    const c = new Counter();
    c.inc(); c.inc(); c.inc();
    console.log(c.count);
    
  5. Question 5
    5

    A private class field #x can be read from outside the class with obj.#x.

  6. Question 6
    6

    Which of these is the cleanest way to remove duplicates from an array tags?

  7. Question 7
    7

    What does this code log?

    const a = { x: 1 };
    const b = { ...a, y: 2 };
    a.x = 99;
    console.log(b.x);
    
  8. Question 8
    8

    When does a Map beat a plain object?

Pick an answer — instant feedback as you go.