class Lazy { #factory; #initialized = false; #value; constructor(factory) { this.#factory = factory; } get initialized() { return this.#initialized; } get value() { if (!this.#initialized) { this.#initialized = true; this.#value = this.#factory(); this.#factory = null; } return this.#value; } }