Public and private class fields
Why?<p>I feel like the person who proposed this is relatively young and newer to coding. The reason why i say this is the functionality he is proposing can already be done using one of the myriad of JavaScript design patterns - <a href="https:&#x2F;&#x2F;addyosmani.com&#x2F;resources&#x2F;essentialjsdesignpatterns&#x2F;book&#x2F;" rel="nofollow">https:&#x2F;&#x2F;addyosmani.com&#x2F;resources&#x2F;essentialjsdesignpatterns&#x2F;b...</a><p>It can already be done in a clean and easy way with a an anonymous self executing function - (function(){&#x2F;&#x2F;EVERYTHING HERE IS PRIVATE SCOPE})();<p>this also has massive added benefits to execution time and variable name resolutions.<p>Learn more about variable scopes and how powerful JavaScript is.<p>Also recognize that JavaScript is much closer to a functional programming language than a typical Object oriented language. If u are going to try and make JavaScript objects try and behave like classes that you know and love from java, you are gonna have a BAD time. its going to take way longer to code, gonna be hard to maintain and reason about it. Try instead to write asynchronous event driven code where functions pass data around rather then data passing functions around.<p>Also it is really dumb trying to set private&#x2F;public fields in JavaScript code that runs in the browser, i can still easily access all the variables through a debugger or running in a custom environment( like Selenium).<p>and if your concern is about keeping that data safe in a server environment.. well then your really shouldn&#x27;t rely on private&#x2F;public to keep you safe and put in actual user role management and access at the application level, and one of the best way to do that is utilize a graph database to store and resolve complex user roles and permissions in your application.