I get the item in the realtime database where the email child equals the email in the localStorage and that works just fine.
however when i try to log the username, it returns undefined instead of the actual username
let useremail = localStorage.getItem("useremail")
firebase.database().ref("/users").orderByChild('email').equalTo(useremail).on("value", function(snap){
let data = snap.val();
console.log(data.username)
})
Anyone knows how to fix this?
database looks like this
and If i log useremail the correct string does show

