title: Create a method to apply filters in a task list
body: <p>I have a homework assignment with one question I am having difficulty with.</p>
  
  <p>I need to create a method titled changeView that applies filters to an array. The buttons and filters are already written, but I need to code the method that applies them and updates the array with the new view. There are 3 separate buttons: all, active, and completed found in the code.</p>
  
  <p>I've tried calling the switch statement in the method, but I don't think I have either the write syntax, or I am not using the correct variables.</p>
  
  <p>The array name is todos</p>
  
  <p>code from the buttons:</p>
  
  <pre><code>&lt;div class="filters"&gt;
                  &lt;button :class="{selected: view === 'all'}" @click="changeView('all')"&gt;All&lt;/button&gt;
                  &lt;button :class="{selected: view === 'active'}" @click="changeView('active')"&gt;Active&lt;/button&gt;
                  &lt;button @click="changeView('completed')" :class="{selected: view === 'completed'}"&gt;Completed&lt;/button&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>code from the filters:</p>
  
  <pre><code>computed: {
              itemsLeft() {
                  return this.todos.filter(t =&gt; !t.isDone).length;
              },
              activeTodos() {
                  return this.todos.filter(t =&gt; !t.isDone);
              },
              completedTodos() {
                  return this.todos.filter(t =&gt; t.isDone);
              },
              filteredTodos() {
                  switch (this.view) {
                      case 'active':
                          return this.activeTodos;
                      case 'completed':
                          return this.completedTodos;
                      default:
                          return this.todos;
  </code></pre>
  
  <p>If there's any more sections of code needed, or if anyone needs all the code lines, I can paste it in. I tried to emit what wasn't needed for simplicity.</p>