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 Answers
+ 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.