title: Trouble using .indexOf() with .filter()
body: <p>Newbie to javascript and es6 here.  I'm building a react-native app with firebase and redux.  One of my action creators is really just a search bar function.  I'm fetching data from Firebase with this code:</p>
  
  <pre><code>export const searchResult = () =&gt; {
    const { currentUser } = firebase.auth();
    return (dispatch) =&gt; {
      firebase.database().ref(`/users/${currentUser.uid}/entries`)
        .on('value', snapshot =&gt; {
          const obj = snapshot.val();
  </code></pre>
  
  <p>That part of the function is working swimmingly. Then I want to turn the data into an array, instead of just some objects.</p>
  
  <pre><code>  const array1 = Object.keys(obj).map(function(key) {
      return [obj[key]];
  });
  </code></pre>
  
  <p>And again, this executes perfectly. It's the next bit of code that I'm for certain is wrong, just don't know how to fix it.  I'm wanting to return a filter of array1 according to what goes in the search bar. Here I have search bar hard-coded to element (I'll switch that once I get the code working).  </p>
  
  <pre><code>      const element = '0';
        const array2 = array1.filter(array1.indexOf(element) !== -1);
  
  
          dispatch({ type: SEARCH_RESULT_SUCCESS, payload: array2 });
        });
    };
  };
  </code></pre>
  
  <p>As of now, I'm pretty sure this is just returning a boolean of false, instead of returning objects from the array that match element. Do I need another function in here to bridge my logic? What am I missing? Any help is much appreciated! Thanks in advance!  </p>