Lately I’ve been spending a lot of time in Firebase. It’s easy and perfect for small little web apps. But I ran into a challenge where I couldn’t load Firebase data into a global variable. I wanted to use that global variable in other parts of my app. But it always came back ‘undefined‘. It’s then that I read up on the documentation and learned that the function that retrieves the data is asynchronous. Which in simple terms means, the function does not return data when you expect it. Therefore the global variable you’re hoping to fill comes back ‘undefined’. So after some research, I learned the a great way to pass data from one function to another in Firebase is to use a Callback Function. A great video explanation of Callbacks here.