Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 39cf84f

Browse files
jabacchettaljharb
authored andcommitted
[guide] Add clarification to arrow functions
Clarify and correct explanation — to be consistent with section 7.1 (use named function expressions).
1 parent 67e3443 commit 39cf84f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,11 +912,11 @@ Other Style Guides
912912
## Arrow Functions
913913

914914
<a name="arrows--use-them"></a><a name="8.1"></a>
915-
- [8.1](#arrows--use-them) When you must use function expressions (as when passing an anonymous function), use arrow function notation. eslint: [`prefer-arrow-callback`](http://eslint.org/docs/rules/prefer-arrow-callback.html), [`arrow-spacing`](http://eslint.org/docs/rules/arrow-spacing.html) jscs: [`requireArrowFunctions`](http://jscs.info/rule/requireArrowFunctions)
915+
- [8.1](#arrows--use-them) When you must use an anonymous function (as when passing an inline callback), use arrow function notation. eslint: [`prefer-arrow-callback`](http://eslint.org/docs/rules/prefer-arrow-callback.html), [`arrow-spacing`](http://eslint.org/docs/rules/arrow-spacing.html) jscs: [`requireArrowFunctions`](http://jscs.info/rule/requireArrowFunctions)
916916

917917
> Why? It creates a version of the function that executes in the context of `this`, which is usually what you want, and is a more concise syntax.
918918

919-
> Why not? If you have a fairly complicated function, you might move that logic out into its own function declaration.
919+
> Why not? If you have a fairly complicated function, you might move that logic out into its own named function expression.
920920

921921
```javascript
922922
// bad

0 commit comments

Comments
 (0)