Global Function Pollution
Published on
Published on
When you pollute the global name space, you can no longer search for the name of the function. This makes it harder to find where the function is used. It also makes it harder to find where the function is defined.
Sharing a name with a global function can also cause unexpected behavior. For example, if you have a function called alert
, it will override the global alert
function. This can cause unexpected behavior when you try to use the global alert
function.