I have some javascript code I’m studying that has a class method defined that uses the pound sign as it’s first character. All references to it use the pound sign as well
constructor(canvasWidth, canvasHeight) {
...
this.#initialize();
};
#initialize() {
...
};
This has me confused as everything I’ve read states that function names must begin with a letter or underscore and
subsequent characters must be letters, numbers, or an underscore. I’ve removed the character and the script runs the same as with it. I’ve relocated the character inside the name and the name is marked as an error within VS Code. I can also create my own method with the pound sign with the class and call it without error.
Is there some special meaning to this character? If so, why can’t I find it in any JS documentation?