There is a global variable a in javascript code. If the function setting the variable’s value is located below in the code, will the assigned value be visible higher up in the code?

I need the function in the middle of the code to get the value that was set in the end of the code. Is this possible?