I'm use this function to check Answer. Value of compareAns
should return true/false but it return undefined.
function compareAns(quiz, ansIndex) {
let ansRef = firebase
.database()
.ref("Questions/" + quiz + "/ans/" + ansIndex);
ansRef.on("value", (snapshot) => {
if (snapshot.exists()) {
return snapshot.val().is_correct;
} else console.log("No data");
});
}