title: Why does having [].map with curly brackets change the way it works?
body: <p>So, basically I have this:</p>
  
  <pre><code>Array.prototype.toString = function() {
      return ("[" + this.map(thing =&gt; thing = '"' + thing + '"').join(', ') + "]")
  }
  </code></pre>
  
  <p>When I call it:</p>
  
  <pre><code>['foo', 'bar'].toString()
  </code></pre>
  
  <p>It returns</p>
  
  <blockquote>
    <p>"["foo", "bar"]"</p>
  </blockquote>
  
  <p>Now, THAT would work perfectly. This one (with curly brackets) doesn't seem to work like I wanted it to:</p>
  
  <pre><code>Array.prototype.toString = function() {
      return ("[" + this.map(thing =&gt; {thing = '"' + thing + '"'}).join(', ') + "]")
  }
  </code></pre>
  
  <p>and it returns: </p>
  
  <blockquote>
    <p>[, ]</p>
  </blockquote>
  
  <p>So can someone tell me the difference? I don't know why [].map works like this.</p>