ES6 Arrow function with brackets
<p>I came across a little problem in my code which was kind of confusing to me and hope someone could explain why it does the things it does.</p>

<p><strong>Code 1</strong></p>

<pre><code>sendText(){
    return this.http.get('/api')
        .map((response:Response) =&gt; response.json());
}
</code></pre>

<p><strong>Code 2</strong></p>

<pre><code>sendText(){
    return this.http.get('/api').map((response:Response) =&gt; {
        response.json();
    });
}
</code></pre>

<p>The key difference between these two code is that in <strong>Code 2</strong> I placed the brackets after the arrow function to add my tasks inside those brackets and in <strong>Code 1</strong> I took the brackets out and place the task on one line.</p>

<p>My question is why does my object coming from the server side coming back as undefined in <strong>Code2</strong> with the subscribe method that angular2 provided while <strong>Code1</strong> returns the object I suspect.</p>