It means private variable.
class Car{
#color = "#FFF";
// a getter to read the value
get color() { return this.color; }
}
If you try to affect the private variable from outside of this class it will fail including passing a method inside this class to another system. I will say that debuggers such as the browser's console is still able to see these values for debugging.
E.G
class Car{
#color = "#FFF";
// a getter to read the value
get color() { return this.color; }
#setColor = (color) => {this.#color = color}
passColorSetter = (fn) => {
fn(this.#setColor); // this is not allowed
// as the referenced function in fn is not defined in this class
}
}
So they are truly private unlike the hacks that used to exist
E.G
function Car{
let color = "#FFF";
this.getColor = function(){ return color; }
let setColor = (c) => {color = c}
passColorSetter = (fn) => {
fn(setColor); // this would work
// and allow the fn referenced function to call setColor
}
}