title: javascript When I try to use a array ,it shows undefined
body: <p>When I use the second array,it shows undefined,but I can use the first array.</p>
  
  <pre><code>this.$axios.get("/classes/")
    .then(response =&gt; {
      this.tableData = response.data;
      for (var i = 0; i &lt; response.data.length; i++) {
        this.cName.push(response.data[i].className);
      }
      for (var ii = 0; ii &lt; response.data.length; ii++) {
        this.$axios.get("/classStudent/?className=" + this.cName[ii])
          .then(response =&gt; {
            this.cPeoplecount.push(String(response.data.length));
          })
      }
    })
  </code></pre>
  
  <p>the first array is cName,the second array is cPeoplecount.</p>
  
  <p><a href="https://i.stack.imgur.com/PZmAY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PZmAY.png" alt="console log"></a> </p>