title: Fat arrow usage with map
body: <p>JavaScript newbie here. While trying to use Arrray.map with fat arrow, I am getting compilation errors. Below is my sample code along with the error. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var employeesWithComplexLocation = [{
    "name": "jon",
    "location": {
      "country": "usa",
      "city": "austin"
    }
  }, {
    "name": "jane",
    "location": {
      "country": "usa",
      "city": "houston"
    }
  }, {
    "name": "mary",
    "location": {
      "country": "usa",
      "city": "dallas"
    }
  }];
  
  var employeesWithOnlyCity = employeesWithComplexLocation.map(function(element) {
    return {
      name: element.name,
      location: element.location.city
    };
  });
  
  
  console.log(employeesWithOnlyCity);
  console.log('Now using fat arrow:')
  
  employeesWithOnlyCity = employeesWithComplexLocation.map(e =&gt; {
    name: e.name,
    location: e.location.city
  });
  
  console.log(employeesWithOnlyCity);</code></pre>
  </div>
  </div>
  </p>
  
  <p>Array.map works as expected with anonymous function, but gives below error when I use fat arrow instead.</p>
  
  <pre><code>employeesWithOnlyCity = employeesWithComplexLocation.map(e =&gt; {
    name: e.name,
    location: e.location.city
  });
  
  SyntaxError: Unexpected token :
  </code></pre>
  
  <p>The fat arrow works fine with Array.every, or Array.filter. Not sure what I am missing here with Array.map</p>