title: KnockoutJS filtering an array
body: <p>I have an observable array that contains a list of object that I want to filter through based on a user input. If the user searches a word that appears in the array in two different places then the filter function should return the title of both objects and delete or hide all other objects in the array that did not match the input from the user. I must use knockout js to preform this feature which is still new to me. Currently my filter function checks to see if the user input is included in a title of one of the objects within the array and if it is not then it removes the object. However, this not providing me what I need as it does not accurately filter the list.</p>
  
  <p><strong>My ViewMode</strong></p>
  
  <pre><code>var viewModel = function() {
  var self = this;
  self.filter = ko.observable('');
  self.locationList = ko.observableArray(model);
  self.filterList = function(){
  
      return ko.utils.arrayFilter(self.locationList(), function(location) {
  
        if(location.title == self.filter()){
  
          return location.title
        }
  
         else if( location.title.includes(self.filter()) ){
  
            return location.title
         }
  
         else{
  
            return self.locationList.remove(location)
         }
  
      });
    };
  }
  </code></pre>
  
  <p><strong>The View</strong></p>
  
  <pre><code>   &lt;section class="col-lg-2 sidenav"&gt;
        &lt;div class="row"&gt;
          &lt;div class="col-lg-12"&gt;
            &lt;div class="input-group"&gt;
              &lt;input data-bind="textInput: filter"
               type="text" class="form-control" placeholder="Filter Places"
               aria-describedby="basic-addon2" id="test"&gt;
              &lt;button data-bind="click: filterList id="basic-addon2"&gt;
                &lt;i class="glyphicon glyphicon-filter"&gt;&lt;/i&gt;
              Filter
            &lt;/button&gt;
            &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="col-lg-12"&gt;
            &lt;hr&gt;
            &lt;div data-bind="foreach: locationList"&gt;
              &lt;p data-bind="text: $data.title"&gt;&lt;/p&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/section&gt;
  </code></pre>