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 RĂ©ponses
+ 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.