I have a problem with global variables in javascript. Why latitude and longitude don't change?
var latitude;
var longitude;
function initMap() {
var reportDb = firebase.database().ref("Report");
reportDb.once("value").then(function(snapshot) {
snapshot.forEach(function(childSnapshot) {
longitude = childSnapshot.child("longitudine").val();
latitude = childSnapshot.child("latitudine").val();
});
})window.alert(longitude);}
same problem with latitude