Emmanuel Akinfulubi

Quiz

30 questions across the whole course. Every option is explained the moment you answer, right or wrong, because the explanation is the point and the score is not. Nothing is recorded.

0 / 30 Answer a question to begin.

Question 1

What is an object in JavaScript, most precisely?

Question 2

What does bus.owner evaluate to when the object has no owner property?

Question 3

Which of these does const prevent?

Question 4

After const b = a where a is an object, what is true?

Question 5

What makes a function a "method"?

Question 6

Given const f = obj.method; f(); in strict mode, what is this inside the call?

The code in question

const obj = {
  name: 'Jibowu park',
  method() { return this; },
};

const f = obj.method;
console.log(obj.method());
console.log(f());

Output


      

Question 7

Why should you never write an object literal method as an arrow function?

Question 8

Which fix keeps this correct when passing a method as a callback, using the exact same function object each time?

Question 9

What is the main advantage of a factory function over a class?

Question 10

What is the cost of a factory function that defines its methods inline?

Question 11

Which is NOT one of the four things new does?

Question 12

What happens when you call a class without new?

Question 13

What does property lookup do when a property is not on the object?

Question 14

What is the difference between 'x' in obj and Object.hasOwn(obj, 'x')?

Question 15

What will this print, and why?

The code in question

function Bus(plate) { this.plate = plate; }
Bus.prototype.faults = [];

const a = new Bus('LAG-441-XA');
const b = new Bus('ABJ-772-KM');
a.faults.push('cracked windscreen');

console.log(a.faults);
console.log(b.faults);

Output


      

Question 16

In a class body, where do fields and methods end up?

Question 17

What separates members inside a class body?

Question 18

What does JSON.stringify do with a #private field?

Question 19

What happens if you write obj.#field outside the class that declares it?

Question 20

What does a leading underscore, as in this._balance, actually enforce?

Question 21

When should a computed value be a getter rather than a method?

Question 22

Why does this throw a RangeError about the call stack?

The code in question

class Broken {
  set label(value) {
    this.label = value.trim();
  }
}

try { new Broken().label = ' x '; }
catch (err) { console.log(err.name); }

Output


      

Question 23

What should a getter do when it would otherwise return a private array?

Question 24

Where does a static member live?

Question 25

Inside a static method, what is this?

Question 26

What must a subclass constructor do before touching this?

Question 27

What does super.method() do?

Question 28

Which is the clearest sign that inheritance was the wrong tool?

Question 29

You have buses that may have air conditioning, may have a roof rack, or may have both. What does a class hierarchy force?

Question 30

Which SOLID principle does a growing switch (thing.type) in shared code violate first?

Newsletter

New writing, when it lands.

Occasional notes on shipping software with AI agents. No schedule, no filler, unsubscribe in one click.