title: Can't resolve variable in Vue function
body: <pre><code>data: function () {
           return {
            selectedScope:'',
          }
        },
  
  
  
  methods: {
     displayScope: function(newScope) {
              console.log(this.selectedScope)
  
              var resultArray = []
              this.tableData.forEach(function (data) {
  
                  if (data.iog === this.selectedScope) {   // This is where the error 
                      resultArray.push(data)
                  }
              });
  
          }
  }
  </code></pre>
  
  <p>I can't seem to figure out why i m getting:</p>
  
  <blockquote>
    <p>Cannot read property 'selectedScope' of undefined</p>
  </blockquote>
  
  <p>inside the <code>forEach</code>. </p>
  
  <p>Why?</p>