Revealing module pattern

Javid Salim
Mar 5, 2023

Revealing module pattern is such a rule that let’s say you want to make some features of the object inaccessible and others accessible. This is the same as private public fields in OOP logic. Of course, it is convenient to do it with classes, but it is also possible with functions, and functions called IIFE allow us to work with this pattern. Below I will share the code parts that show the task and its solution. The codes will explain everything to you more clearly.

only doSomething method gonna be accesable!!!
Solving With IIfe

Now you can see that _getData only accesable only inside ..

--

--