Dot accessor will mean public prop obj.prop
Sharp accessor will mean private prop obj#prop
Example:
class Cat {
constructor(name){
this#name = name
}
#say() {
alert(`My name ${this#name}`)
}
}
var q = new Cat('Tom')
q.say() // error
q#say() // error
Example 2:
class Point {
set x(value){
this#x = value
}
get x(){
return this#x
}
}
Example 3:
class Collection {
self(){
return this
}
#say(){
alert('i am private')
}
run(){
this.self()#say() // alert("i am private")
}
}
Dot accessor will mean public prop
obj.propSharp accessor will mean private prop
obj#propExample:
Example 2:
Example 3: