This line of code is getting document count from firestore database it works fine when i call the variable inside the function but outside its undefine.
 var LM35TOTALRES; // I WANT TO STORE HERE
    db.collection("LM35").get().then(function(querySnapshot) {      
    
        LM35TOTALRES = querySnapshot.size //DATA THAT I WANT
         
    console.log(LM35TOTALRES); // THIS IS WORKING       
    });
    console.log(LM35TOTALRES); // NOT WORKING 
 
     
    