Skip to content

Commit 298255f

Browse files
authored
Merge pull request #212 from ofarukcaki/patch-1
Update arrow_function.md
2 parents ef7c319 + 1287bfd commit 298255f

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed
Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
1-
# Arrow Function
1+
# Arrow Function
2+
An arrow function expression is a syntactically compact alternative to a regular function expression.
3+
4+
Example:
5+
```javascript
6+
// Regular function
7+
function greet(name){
8+
console.log("Hello " + name);
9+
}
10+
11+
// Arrow function equivalent
12+
const greet = name => {
13+
console.log("Hello " + name)
14+
}
15+
```
16+
Both functions above are equivalent to each other.
17+
18+
If we have more than one function argument then we should put them in paranthesis like this:
19+
```javascript
20+
const exampleFunc = (name,age,eyeColor) => {
21+
// ...
22+
}
23+
```

0 commit comments

Comments
 (0)