I've just started using Firebase and i can't get data from database. Here's my code
const books = firebase.database().ref('Books');
var index;
books.once("value", function(snapshot) {
   index = snapshot.val().Count
});
console.log(index)
Console log gives undefined. Where's the problem? Thanks.
 
     
     
     
     
    