title: Javascript: Call a method inside another method
body: <p>I have a simple app, that triggers a boolean and sets a task to completed:</p>
  
  <p>But I want to be able use a "Complete All" Button and set every task to complete. This here works fine:</p>
  
  <pre><code>  completeAll: function() {
      this.tasks.forEach(function(task) {
        task.completed = true;
      });
    },
  </code></pre>
  
  <p><a href="http://codepen.io/anon/pen/avzMYr" rel="nofollow">http://codepen.io/anon/pen/avzMYr</a></p>
  
  <p>But instead of setting it directly, I would like to use a method that is called like this, because I have a lot of other code that needs to be separated.</p>
  
  <pre><code>  completeTask: function(task) {
      task.completed = true;
    },
  
    completeAll: function() {
      this.tasks.forEach(function(task) {
        this.completeTask(task);
      });
    },
  </code></pre>
  
  <p>Yet this does not work, see here:</p>
  
  <p><a href="http://codepen.io/anon/pen/EVaMLJ" rel="nofollow">http://codepen.io/anon/pen/EVaMLJ</a></p>
  
  <p>Any idea how to call the "completeTask(task)" method inside of the completeAll method?</p>