Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 06d1ad9

Browse files
authored
Arrow Functions (Fat Arrows)
1 parent 2961493 commit 06d1ad9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

‎README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
11
# Functional Programming Javascript
2+
3+
Functional programming is a style that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data.
4+
5+
## Arrow Functions (Fat Arrows)
6+
7+
Arrow functions create a concise expression that encapsulates a small piece of functionality. Additionally,
8+
arrows retain the scope of the caller inside the function eliminating the need of `self = this`.
9+
10+
For example:
11+
12+
```javascript
13+
// const multiply = function(x,y) {
14+
//
15+
return x * y;
16+
// }
17+
// Can be rewritten as:
18+
// const multiply = (x, y) => { return x * y };
19+
// Since the function is a single expression return and braces are not
20+
needed.
21+
const multiply = (x, y) => x * y;
22+
console.log(multiply(5,10)) //50
23+
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /