Encapsulation

Keeping an object's data behind its methods so it's changed the safe way.

What is Encapsulation in JavaScript?

Encapsulation — Keeping an object's data behind its methods so it's changed the safe way.

class Thermostat {
    #temperature = 20;

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

Level: Journeyman · More JavaScript terms at this level

Updated

In other subjects