0
(JS) Private properties syntax highlighting issue
Hi all, I was working on a project and found that when using ES6 private object properties, the syntax highlighting fails (but the script runs correctly - see example). I was just curious if I’m missing some non-fatal problem that’s throwing the highlighting parser off, or if the highlighting just hasn’t been updated to reflect that structure. The error occurs in the “Web” environment as well, but I didn’t want people to have to find the tab! Many thanks! https://code.sololearn.com/czFaWxC5pS52/?ref=app
3 Antworten
+ 1
Jeremy Miller
You cannot access private fields directly outside the class.
So obj.#bar will give error.
obj.bar is undefined because bar is not defined inside class.
0
A͢J I understand that. The script itself isn’t the issue; I’m trying to understand why the syntax highlighting doesn’t work when private properties are included. I suspect it’s the parser but wanted to make sure.
0
Syntax highlighting is a human aid feature implemented in IDEs and code editors. But their highlighting preference may not represent engine's syntax recognition nor its ability in processing a code.