Emmanuel Akinfulubi

Glossary

42 terms, each with the one-line version you would say out loud and the fuller version you want when something is not behaving. Every entry names the lesson that covers it.

42 terms

__proto__

A deprecated accessor for an object’s prototype.

Functionally the same as Object.getPrototypeOf and Object.setPrototypeOf. Read it in old code and in devtools; do not write it.

Lesson 06

Abstract class

A class meant only to be extended, never instantiated.

JavaScript has no keyword for it. Throw when new.target is the base class, and throw from any method a subclass must supply. Checking for required methods in the constructor moves the failure earlier.

Lesson 13

Abstraction

Deciding what the caller never needs to know.

Encapsulation is the mechanism; abstraction is the judgement about what to point people at. Measure it by how much a caller must understand to use the thing correctly.

Lesson 13

Class

A template for objects, and in JavaScript a syntax over constructor plus prototype.

A class declaration creates a function whose prototype holds the methods. Class bodies are always strict, are not hoisted, and cannot be called without new.

Lesson 07

Closure

A function that keeps access to the variables where it was created.

The mechanism behind private state in factories. A variable declared inside the factory is not a property of the returned object, so there is nothing for outside code to name.

Lesson 04

Composition

An object holding other objects as parts.

The answer when the honest sentence is "has a" rather than "is a", and the only workable answer when things vary along two independent axes. Costs forwarding methods, buys control over what is exposed.

Lesson 14

Constructor

The function that runs when you write new.

In a class it is the member named constructor. In older code it is any function called with new, capitalised by convention. There can be at most one per class.

Lesson 05, 07

Delegation

Passing a call along to something you hold.

The concrete work of composition. You write a small method that calls the inner object, which lets you expose some of its behaviour and withhold the rest.

Lesson 14

Dependency injection

Passing collaborators in rather than building them inside.

A class that constructs its own clock, store or network client cannot be tested or reused. Accept them as constructor options with sensible defaults and both problems disappear.

Lesson 15

Design pattern

A recurring shape with a name.

The ones worth knowing early: Factory, Observer, Strategy, Adapter. Reach for the name after you notice the shape twice, not before; a codebase designed around patterns from day one is harder to read than one that grew into them.

Lesson 15

Duck typing

Judging a value by what it can do, not what it is.

If it responds to prepare(), treat it as preparable. This is how most idiomatic JavaScript achieves polymorphism, and it lets your code accept things its author never anticipated.

Lesson 12

Encapsulation

Keeping data and its operations together, and hiding the rest.

The test: can an outsider put the object into a state your methods would have refused? If yes, nothing is encapsulated. Real mechanisms are closures and # fields; a leading underscore is only a comment.

Lesson 08

extends

The keyword that makes one class inherit another.

Sets Sub.prototype’s prototype to Base.prototype, and Sub’s prototype to Base. You can extend built-ins including Array and Error.

Lesson 11

Factory function

A function that builds and returns an object.

No new, no ceremony. Its two real advantages are closure privacy and the freedom to return different shapes. Its cost is one copy of each method per object.

Lesson 04

Getter

A method read without brackets, like a property.

Lets you swap a stored value for a computed one without touching any caller. Use one when the thing reads like a fact and is cheap; use a method when it is slow or has side effects.

Lesson 09

Immutability

The property of not changing after creation.

Object.freeze is a shallow freeze: nested objects stay mutable. Immutable designs replace mutation with methods that return a new object, like seat.movedTo(row).

Lesson 08

Inheritance

Building a specific class on a general one.

Written with extends. It links both the instance chain and the class chain, which is how statics are inherited too. Powerful, easily overused, and constrained to a single axis of classification.

Lesson 11

Instance

One object made from a class or constructor.

Being an instance means the class prototype is somewhere on the object’s chain, which is exactly what instanceof checks. It does not mean that class’s constructor necessarily ran.

Lesson 05

instanceof

Asks whether a constructor’s prototype is on an object’s chain.

It does not compare names or check which function ran, which is why it works across inheritance. It can give the wrong answer when two copies of the same class exist; a private-field brand check is more reliable.

Lesson 05, 08

Interface

The set of things a caller can do with an object.

JavaScript has no interface keyword, so an interface here is an agreement: these method names, these shapes. It is real even though nothing checks it.

Lesson 13

Liskov substitution

A subclass must work wherever its parent works.

A subclass that throws from, ignores, or narrows an inherited method has broken this. The fault is usually the parent promising too much rather than the child implementing badly.

Lesson 11, 15

Method

A function stored as a property.

There is nothing structurally different about the function. Its only distinction is that being reached through an object gives it a useful this.

Lesson 02

Mixin

A function that takes a class and returns an extended one.

Used to share stateless behaviour across unrelated classes. Still inheritance underneath, so each mixin adds a chain link and name collisions are silent.

Lesson 14

new

The operator that builds an object from a constructor.

Four steps: create an empty object, link its prototype to Ctor.prototype, call the constructor with this set to it, return it unless the constructor returned a different object.

Lesson 05

new.target

The constructor that new was called on, or undefined.

In a base class it equals the base class only when someone instantiated it directly; when a subclass calls super() it is the subclass. That difference is how you make a class abstract.

Lesson 05, 13

Object

A value that holds named properties.

A key-value structure where each key is a string or symbol. Almost everything in JavaScript that is not a primitive is an object, including arrays, functions and classes themselves.

Lesson 01

Open/closed

Add a case by adding code, not by editing working code.

A switch on a type that keeps growing is the warning sign. The usual fix is polymorphism, so a new type is a new class rather than an edit to an old function.

Lesson 15

Own property

A property on the object itself, not inherited.

Object.hasOwn(obj, key) asks about own properties only; key in obj searches the whole chain. Object.keys returns own enumerable keys.

Lesson 06

Polymorphism

Many types answering the same call, each in its own way.

It does not require inheritance. Any objects sharing a method name are polymorphic for that call, which JavaScript developers call duck typing. Its practical value is deleting type switches.

Lesson 12

Private field

A field whose name begins with #, unreachable outside the class.

The hash is part of the name. Invisible to Object.keys, spread and JSON.stringify. Touching it from outside is a SyntaxError, not a runtime error. #field in obj is an unforgeable brand check.

Lesson 08

Property

A key paired with a value, on an object.

Properties can be data or accessors (a getter/setter pair). They also carry flags: enumerable, writable and configurable, which is what Object.defineProperty lets you set.

Lesson 01, 09

Prototype

The object another object falls back to for anything it does not have.

Every object has an internal link to one prototype or to null. Property lookup walks that chain. Ctor.prototype is the object instances will hang from, which is a different thing from the prototype of Ctor itself.

Lesson 06

Prototype chain

The sequence of prototypes above an object, ending at null.

A typical instance chain is: the object, its class prototype, any parent class prototypes, Object.prototype, null. This chain is the only inheritance mechanism JavaScript has.

Lesson 06, 11

Reference

What an object variable actually holds.

Assignment copies the reference, so both names point at one object. { ...obj } copies one level; structuredClone(obj) copies all levels but drops functions.

Lesson 01

Setter

A method that runs when you assign to a property.

Its honest job is validation and normalisation. Never assign to the same property name inside its own setter, or it calls itself forever. A getter with no setter is silently read-only unless you add a throwing setter.

Lesson 09

Shadowing

An own property hiding an inherited one of the same name.

Lookup stops at the first match, so the object always wins. Assignment creates an own property rather than writing up the chain, which is why deleting an own property can make an inherited value reappear.

Lesson 06

Shallow copy

A copy of the top level only.

Produced by spread or Object.assign. Nested objects are still shared, which is a very common source of bugs that appear far from the copy.

Lesson 01

Single responsibility

One reason to change per class.

A class that holds data, formats it and saves it has three unrelated reasons to be edited, so three unrelated changes touch the same file.

Lesson 15

Static member

A field or method on the class itself.

Reached through the class name, never through an instance. Inside a static method this is the class, so new this() keeps subclasses working. Subclasses inherit statics, and an object-valued static is shared until redeclared.

Lesson 10

super

A reference to the parent class from inside a subclass.

super(...) calls the parent constructor and must run before this is touched. super.method() calls the parent’s version, skipping your override. Unavailable inside a nested function, available inside an arrow.

Lesson 11

this

The object that was holding the function when it was called.

Determined by the call site, not the definition. Method call: the thing before the dot. Plain call: undefined in strict mode. new: the new object. call/apply/bind: whatever you supplied. Arrow function: whatever this was where it was written.

Lesson 03

Value object

A small immutable object defined entirely by its values.

Two of them with the same contents should be considered equal, which means giving them an equals method, since === compares identity. Freezing in the constructor makes them safe to pass anywhere.

Lesson 08

Newsletter

New writing, when it lands.

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