Drží pomenovanú množinu instancií — na každý kľúč najviac jednu.
class Connection { constructor(name) { this.name = name; }} class Connections { static #byKey = new Map(); static forKey(key) { if (!Connections.#byKey.has(key)) { Connections.#byKey.set(key, new Connection(key)); } return Connections.#byKey.get(key); }} const inventory = Connections.forKey('inventory');const accounting = Connections.forKey('accounting');const report = Connections.forKey('inventory'); inventory === report; // true — same key, same instanceinventory === accounting; // false — different key, different instance