Global variables are known anti-pattern . Localizing global variables minimizes the disadvantages of using global variables.
It is also associated with DI . For example: what if you have 10 modules and you want one of them to use a replacement for jQuery, for example. zeptojs . If all your modules used global jQuery or $, you could not do this.
It is also useful to explicitly identify your dependencies, which is achieved using this localization technique. It increases readability and reduces grip.
source share