Using modules in JavaScript
Modules are one of the most commonly used JavaScript features because most JavaScript frameworks and libraries leverage the module feature for organization and componentization. Modules in JavaScript are probably underused—some developers even think that the import and export keywords are ReactJS features. In this article, we'll explain how to encapsulate code using the module system to make your projects cleaner. To start, let's take a look at what encapsulation is in the next section.