Load order affecting javascript files?

Permalink
Currently I am implementing a multipage app using firebase as the login system. The login mechanism is implemented in the top right block of the webpage using javascript.

However when I attempt to access firebase in the body of the webpage, the user object, which was created in the login button is no longer available.

My understanding is, and correct me if I'm wrong, that all javascript files will run the same separate or together as long as they are in the same order.

Any help is appreciated