var ref = firebase.database().ref("games/" + gameId + "/patterns");
ref.on("child_changed", function(snapshot){
var pattern = snapshot.key;
console.log(pattern);
});
Currently, the code snippet above only logs the key. But how can I extract the player name whose status is equal to 0?
I noticed that the snapshot contains all the child data I need when I use the following code:
var ref = firebase.database().ref("games/" + gameId + "/patterns");
ref.on("child_changed", function(snapshot){
var value = snapshot.val();
console.log(value);
});
Even though I am able to access the data using this approach, I'm still struggling to extract the specific child's data as required.