Zdieľa nemennú časť stavu medzi mnohými objektmi a šetrí tak pamäť.
class Glyph { constructor(letter, font) { this.letter = letter; this.font = font; } draw(x, y) { // draws itself at the given position }} class GlyphFactory { static #shared = new Map(); static forLetter(letter) { if (!GlyphFactory.#shared.has(letter)) { GlyphFactory.#shared.set(letter, new Glyph(letter, 'serif')); } return GlyphFactory.#shared.get(letter); }} class Placement { constructor(letter, x, y) { this.glyph = GlyphFactory.forLetter(letter); this.x = x; this.y = y; } draw() { this.glyph.draw(this.x, this.y); }} const a1 = new Placement('a', 10, 4);const a2 = new Placement('a', 24, 4);const b1 = new Placement('b', 38, 4); a1.glyph === a2.glyph; // true — the shared part is a single objecta1.x === a2.x; // false — the own part belongs to each one