title: Saving the array.length to a variable in order to manipulate the latter
body: <p>Good day everyone,</p>
  <p>I am fairly new to working with vue.js and unfortunately don't have anyone in my environment which I could ask for help. Currently I am trying to fix a few bugs in an existing project and got stuck on a rather simple task.</p>
  <p>My current fix is aiming to reduce the variable that saves an array.length after a @click of a button has been made.
  I've already established the connection between the child and parent components and am now looking to somehow save the array.length in a variable to then reduce/increase it everytime the button is clicked.</p>
  <p>The attempts to declare the variable in props or data did not show the expected result so far.</p>
  <p><strong>tl;dr:</strong> I want to declare <em>var a = this.allRootItems.length;</em> somewhere in the code in order to manipulate it in the method <em>calcDeduction()</em> in order to display it through the prop function <em>heading()</em>. The current code does not seem to solve that.</p>
  <p>A few snippets of the relevant code (I am able to provide more if necessary):</p>
  <pre class="lang-js prettyprint-override"><code>data() {
      return {
        showItems: false,
        progress: 0,
        a: 0,
      };
  
  
  computed: {
    ...
    heading() {
      var a = this.allRootItems.length;
      var text = this.section.heading+&quot; (&quot;+this.progress+&quot;/&quot;+a+&quot;)&quot;;
      return text;
    },
    ...
  
    allRootItems() {
        var result = [];
        if (this.checklistid==null) {
          return result;
        }
        var rootItems = this.findRootItemsInStore({ query:{
          sectionId: this.section.id
        } }).data;
        for (var i=0; i&lt;rootItems.length; i++) {
          var itemToDo = this.findCheckItemsInStore({ query:{
            checklistId: this.checklistid,
            rootitemId: rootItems[i].id
          } }).data[0];
          if (itemToDo) {
            if (itemToDo.isTodo) {
              result.push(rootItems[i]);
            }
          }
         }
        return result;
       },
    ...
  
  methods: {
    ...
    calcDeduction(dedValue) {
        if (dedValue==-1) { //-1 and 1 are being swapped on each toggle of the button
          this.a--;
        }
        if (dedValue==1) {
          this.a++;
        }
        console.log(this.a);
      }
    }
  </code></pre>