what does it means declare variables with the symbol "#" in javascript? I am learning about builder pattern and I found it with some examples. Also I saw that the variables are calls with this.#color.
# symbol is different to declare variable with let or var? what is the difference?
thanks
class Car {
#color = null
#spoiler = null
#fuelType = null
#productionDate = null
}
>Solution :
class ClassWithPrivate {
#privateField;
#privateFieldWithInitializer = 42;
#privateMethod() {
// …
}
static #privateStaticField;
static #privateStaticFieldWithInitializer = 42;
static #privateStaticMethod() {
// …
}
}