DEV Community

Discussion on: Power of window object in javascript

 
tiagojpdias profile image
Tiago Dias

I get the objective of doing what you did, I'm just trying to warn that people might be gunning their foot since they are less proficient in code and might do something like:

import Number from 'some-number-utils';

window.Number = Number;

And from here on they're overriding the Number global function and their app might not work as expected due to this override.

Maybe advise to wrap the global variable in __ like window.__<name>__ ?

I'm not against what you did, I'm just trying to warn for possible side effects.

Thread Thread
 
shubhamforu profile image
Shubham

Totally agree. Maybe some variable identifier is good idea. Thanks will update in post as well