I'm attempting to access a variable from within a datasnapshot:
getEmail() {
var test = firebase.database().ref('/users/' + user).once('value')
.then(function(snapshot) {
var email = snapshot.val().email;
});
console.log(email);
}
That console.log doesn't return the database value, and I am also unable to access that email variable elsewhere in my code.