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

Skip to content

Commit b8430d1

Browse files
authored
Fix explanation saying you can do => 5 in JS
This claimed you can leave out the parentheses if you have _no_ parameters, which is false. You cannot do `const x = => 5;`
1 parent 56d42ff commit b8430d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Week2/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const addNum = (num1, num2) => {
143143
If you've done some research, you may come to the following conclusions:
144144

145145
1. First of all, the Arrow Function is anonymous by design. If we want to refer to it, we should store it into a variable.
146-
2. Secondly, the way Arrow Functions can be written can differ (while still working the same way). Sometimes you don't need the `()` if there's a single or no parameters. Sometimes you can `return` a value without use for the `return` keyword.
146+
2. Secondly, the way Arrow Functions can be written can differ (while still working the same way). Sometimes you don't need the `()` if there's a single parameter. Sometimes you can `return` a value without use for the `return` keyword.
147147

148148
Another big important feature of Arrow Functions (and difference with ES5 functions) is the way they relate to the `this` keyword: instead of creating a new `this` object, it actually inherits it from the parent scope!
149149

0 commit comments

Comments
 (0)