title: Filtered array returns as 'undefined' in a Leaflet popup
body: <pre><code>array = [{&quot;shop&quot;:&quot;Big Store&quot;, &quot;name&quot;:&quot;Green Bag&quot;},
           {&quot;shop&quot;:&quot;Long Store&quot;, &quot;name&quot;:&quot;Red Shoes&quot;},
           {&quot;shop&quot;:&quot;Big Store&quot;, &quot;name&quot;:&quot;White Tree&quot;}]
  </code></pre>
  <p>To filter it, I made this function</p>
  <pre><code>function filterByShop(array, key, String) {
    return array.filter((obj) =&gt; obj[key] == String)
  };
  </code></pre>
  <p>If I do <code>alert(JSON.stringify(filterByShop(array, &quot;shop&quot;, &quot;Big Store&quot;)))</code>, it returns the array minus the <code>Long Store</code> item.</p>
  <p>However, if I attach the filtered array to a Leaflet popup via this function, it returns as <code>undefined</code></p>
  <pre><code>function shopsPopup(feature, json){
    json.bindPopup(feature.properties.shop + &quot;&lt;/br&gt;&quot; +
                   feature.properties.name + &quot;&lt;/br&gt;&quot; +
                   JSON.stringify(filterByShop(array, &quot;shop&quot;, feature.properties.shop)))
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/9Cobx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9Cobx.png" alt="enter image description here" /></a></p>