Yeah exactly! So javascript is often used to make webpages more dynamic, and to do that you need to refer to specific elements on a webpage. Calling this 1000 times on a webpage can be tedious to type out, so instead you load it to a variable in the global scope, and then you can just call that variable, instead of a full line of code each time!
Scope pollution refers to having multiple different variables with the same name, and this can definitely happen when using the global scope, so as such you don’t want to always call a variable outside it’s function if it’s only to be used for that function. These are things you’ll pick up as you write more functions and programs.
For calling a function you can call it whenever, it depends on your purposes! I generally like to declare all global variables at the very top, then all function declarations, and then all function calls at the end. However sometimes you may need to use functions inside other functions, and so you need to pay attention to the order in which you are declaring them (NOTE: In other languages it literally won’t work if they’re not in the right order, in JS there’s something called hoisting which makes it work, but it’s still best practise and good habit to declare functions in the order they are used)