title: What's is this behavior of JavaScript Array?
body: <p>I'm started to work with JavaScript/Firestore for a few days but i'm facing some issues with the behavior of the laguage in array's. I cannot run array's with a for loop inside a function and almost all the time it returns me an undefined. this is my code:</p>
  
  <p>This is the code who takes all the id's on firestore who the meeting is <em>active</em> :</p>
  
  <pre><code>   function validation () {
  
        let path = firebase.firestore()
        path
          .collection('database')
          .doc('405')
          .collection('meetings')
          .where('active', '==', true)
          .get().then( snapshot =&gt;{
          snapshot.docs.forEach( snapshot =&gt; {        
          this.id_firestore.push(snapshot.id)
          })
  
        }) 
  
      },
  </code></pre>
  
  <p>And this is the code who runs all the id's on <em>id_firestore</em> array and takes all the doubts of the meeting on firestore:</p>
  
  <pre><code>    function search_doubts (){
        let data = this.id_firestore  // in this line data.value = ["QEq1VexdC28BbWRvSFL7","vFsSdDeHJqJQU13dwMwQ"]
        let path = firebase.firestore().collection('database').doc('405').collection('meeting')
  
        console.log(data)    //  here it logs me all the array normally
        console.log(data[0]) // here the log returns me undefined
  
        for (let i = 0; i&lt;data.lenght; i++) {        
          path.doc(data[i]).collection('doubts').get().then( snapshot =&gt;{
            snapshot.docs.forEach( snapshot =&gt; {        
              this.doubts.push(snapshot.data().txt_doubts)
              this.id_firestore_doubts.push(snapshot.id)        
            })
            console.log(data[1]) //here it logs me the data normally
          })         
        }
      }
  </code></pre>
  
  <p>I did too many searchs but i didn't find anything about this behavior, can anybody answer why the function is behaving like this?
  This is the chrome console result's on my debbug:</p>
  
  <p>Console.log(data):</p>
  
  <pre><code>[__ob__: Observer]
  0: "QEq1VexdC28BbWRvSFL7"
  1: "vFsSdDeHJqJQU13dwMwQ"
  length: 2
  __ob__: Observer {value: Array(2), dep: Dep, vmCount: 0}
  __proto__: Array
  </code></pre>
  
  <p>Console.log(data[0]):</p>
  
  <pre><code>undefined
  </code></pre>
  
  <p>Console.log(data[1])</p>
  
  <pre><code>vFsSdDeHJqJQU13dwMwQ
  </code></pre>