title: Function of setInterval in Vue.js
body: <p>I want to perform a <code>while</code> loop with one second of interval.</p>
  <p>The method which I want to operate is;</p>
  <pre><code>new Vue({
      el: &quot;#app14&quot;,
      data: {
          dealerCards: [],
      },
      computed: {
          dealerHand() {
              return CalcHand(this.dealerCards);
          }
      },
      methods: {
          Stand: function() {
              while (this.dealerHand &lt; 17) {
                  this.dealerCards.push(Draw());
                  console.log(&quot;DH: &quot; + this.dealerHand);
              }
          },
      },
  });
  </code></pre>
  <p>CalcHand returns the sum of the input array.</p>
  <p>I rewrite it with <code>setInterval</code> function;</p>
  <pre><code>var dd = setInterval(function() {
      this.dealerCards.push(Draw());
      console.log(&quot;DH: &quot; + this.dealerHand);
  
      if (this.dealerHand &gt;= 17) {
          clearInterval(dd);
          return;
      }
  }, 1000);
  </code></pre>
  <p>However, browser console said <code>this.dealerCards is undefined</code>.
  I wonder if you have any idea why this error shows up.</p>