> For the complete documentation index, see [llms.txt](https://hemantajax-2.gitbook.io/es6-in-depth/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hemantajax-2.gitbook.io/es6-in-depth/arrow-function.md).

# Arrow Function

```javascript
// ES5
function greet(name){
    console.log("Hello! "+ name);
}
greet("Hemant");

// ES6
var greet = (name) => console.log("Hello! "+ name);
greet("Hemant");

// for single method parameter we can ommit () see below
// OR ( as returned value)
var greet = name => "Hello! "+ name;
console.log(greet("Hemant"));
```

## Implicit return {}

```javascript
const winners = ['Rob', "Dome", "Hemant"];

const win = winners.map(w => ({name: w})); // use ()

console.log(win);
```
