Private Field

A class field beginning with # that is accessible only inside its declaring class.

What is Private Field in JavaScript?

Private Field — A class field beginning with # that is accessible only inside its declaring class.

class Thermostat {
    #temperature = 20;

    get temperature() {
        return this.#temperature;
    }
}

Level: Journeyman · More JavaScript terms at this level

Updated