I want to access and use a firebase db child across my whole javascript file.
This is how my db looks like:
var bidAUDUSD;
var audusd = firebase.database().ref('Symbols/AUDUSD/bid').once('value')
.then(function(snapshot){
bidAUDUSD = snapshot.val();
console.log(bidAUDUSD); // this prints the bid;
});
console.log(bidAUDUSD); //this prints undefined;
Any ideas how can I use it globally? Thanks in advance!