DEV Community

LG
LG

Posted on • Edited on

2 2

Visibility modifiers, keyword of static – all in one of JavaScript ES5 standard you need for today ! [2021-12-30] (2 ed.)

Before ES6 came into Object Oriented Programming (OOP) field of JavaScript, we could only dream for a standardized PHP class like syntax , we've got one the moment ES5 been updated to ES6 in 2015 . Still, some people (including myself) tend to keep tactility sense of the syntax into hands (in charge), rather than an easy legible candy a.k.a. so called syntactic sugar of the class pattern presented in ES6. It means we can still preserve all the features of ES6 such visibility modifiers (protected, private) also define methods as static if needed rather than instance-related one. All these are still possible in ES5 which we will see in a minute. Of course ES6 class syntax will probably always remain per recommendation to use , although programmers who want to preserver "feeling" of the code may still be suggested to revise this empowered initially by @obscerno comment :

HOW TO : open console, examine the code & its output as well:

NOTE : As this is 2 ed. I have tried to use protected as variable (member) name within source code , whereas codesandbox IDE red it out . It appears ESnext (2022+) reserved it already , I'll guess there are a shiny future for ECMAScript (JavaScript) is coming for sure , so stunned , JavaScripters !


To conclude : Instead of using this for production, use this as a background of what really is going on in terms of Javascript ES6 class syntax under the hood. I will repeat myself that ES6 class syntax will remain per recommendation to use. That's all for now. If any suggestion or typo found, please leave a comment below. Thank you for reading! :)


Useful references

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more