title: Unable to get object/array size
body: <p>Background: I am using reactjs and my goal is to get data stored in firestore</p>
  
  <p>i have an empty array which i am adding to, after which the array is returned</p>
  
  <p>import firebase from "firebase/app"
  import "firebase/storage"
  import "firebase/firestore"</p>
  
  <pre><code>class firebaseclass {
    constructor() {
      if (firebase.apps.length === 0) {
        firebase.initializeApp(firebaseConfig);
      }
    }
  
    getfirestore() {
      const db = firebase.firestore();
      var storearray = []
      db.collection("data").get().then(function (querySnapshot) {
        querySnapshot.forEach(function (doc) {
          storearray.push(doc.data())
       });
      });
      return storearray
    }
  }
  
  export default new firebaseclass
  </code></pre>
  
  <p>In my homepage, i am calling the function as such</p>
  
  <pre><code>function App() {
    const [names, setnames] = useState({
    })
  
    var datadata = firebaseclass.getfirestore();
    console.log(datadata, "datadatadata")
  
    return (
      &lt;div className="App"&gt;
      &lt;/div&gt;
    );
  }
  
  export default App;
  </code></pre>
  
  <p>this is the console log result</p>
  
  <pre><code>[]
  0: {hasstart: false, lat: ******, long: *******, name: "***", postalcode: ******, …}
  1: {hasstart: false, lat: ******, long: ******, name: "chias crib", postalcode: ******, …}
  2: {hasstart: false, lat: "test3", long: "test3", postalcode: 3, powerlevel: 3, …}
  length: 3
  __proto__: `Array(0)
  
  
  "data data data"`
  </code></pre>
  
  <p>as you can see, i am receiving some form of result</p>
  
  <p>when i </p>
  
  <pre><code>console.log(typeof(datadata), "data data data");
  </code></pre>
  
  <p>i receive</p>
  
  <pre><code>object data data data
  </code></pre>
  
  <p>which is odd, because i returned an array perviously</p>
  
  <p>finally, when i try </p>
  
  <pre><code>  console.log(datadata.length, "data data data");
  </code></pre>
  
  <p>i receive</p>
  
  <pre><code>0 "data data data"
  </code></pre>
  
  <p>i have also tried</p>
  
  <pre><code>var size = Object.keys(datadata).length;
  
  
  console.log(size, "datadatadata")
  </code></pre>
  
  <p>but i have received</p>
  
  <pre><code>0 "datadatadata"
  </code></pre>
  
  <p>i have also tried changing the empty array to an object, and returning an object instead of an array, but the above methods still do not work. What am i doing wrong here?</p>