Global variables can be accessed and modified by any function in the same file, and this can lead to unintended side effects and difficult-to-debug code.
As a best practice, it is usually recommended to limit the use of global variables and to use them only when they are necessary.