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

19th Jul 2022, 4:19 AM
Jeremy Miller
3 ответов
+ 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.
19th Jul 2022, 4:41 AM
A͢J
A͢J - avatar
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.
19th Jul 2022, 4:52 AM
Jeremy Miller
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.
19th Jul 2022, 10:50 AM
Ipang