title: Trying to understand .some() in javascript
body: <p>This is a portion of code from <a href="https://bl.ocks.org/mbostock/4183330" rel="nofollow noreferrer">https://bl.ocks.org/mbostock/4183330</a></p>
  
  <p>I am trying to understand how <code>names.some(function(d)...})</code> works.</p>
  
  <ol>
  <li><p>Shouldn't the anonymous function passed to <code>.some()</code> return a conditional statement that "countires" can be evaluated against? </p></li>
  <li><p>When will <code>names.some(..)</code> return true or false? </p></li>
  <li><p>Why doesn't <code>d.name = n.name</code> create "name" property in "countries" without "return"?  </p></li>
  </ol>
  
  <pre class="lang-js prettyprint-override"><code>queue()
      .defer(d3.json, "world-110m.json")
      .defer(d3.tsv, "world-country-names.tsv")
      .await(ready);
  
  function ready(error, world, names) {
      var countries = topojson.feature(world,world.objects.countries).features
      countries = countries.filter(function(d) {
          return names.some(function(n) {
                    if (d.id == n.id) return d.name = n.name;
       });
  })
  </code></pre>