title: How to filter JSON data by properties that contain certain strings?
body: <p>I have a JSON Object that looks like this:</p>
  
  <pre><code>{
    'name': 'Bob',
    'friends': [
      {
        'name' : 'Ashley (Family)'
      },
      {
        'name' : 'Steven (Non-Family)'
      },
      {
        'name' : 'Chris (Family)'
      }
    ]
  }
  </code></pre>
  
  <p>How can I filter the above, so that it returns only the friends that are family? i.e. friends who's name contains '(Family)'?</p>
  
  <pre><code>function filterFriends (friends) {
  
    return friends.filter(function(i) {
      if (i.name.indexOf('(Family)') &gt; -1) {
        return i.name;
      }
    });
  
  }
  </code></pre>
  
  <p>But the above doesn't seem to work... I don't know if I'm on the right track?</p>