title: Why does map mutate array of objects?
body: <p>Why does <code>map</code> mutate array of objects?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var obj = {
    items: [{
      value: 1,
      selected: true
    }, {
      value: 2,
      selected: false
    }]
  };
  
  var items = obj.items.map(i =&gt; {
    if (i.value === 2) i.selected = true;
    return i;
  });
  
  console.log(obj);</code></pre>
  </div>
  </div>
  </p>