You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/15-function-expressions-arrows/article.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -299,7 +299,7 @@ if (age < 18) {
299
299
}
300
300
}
301
301
302
-
// Here we're out of figure brackets,
302
+
// Here we're out of curly braces,
303
303
// so we can not see Function Declarations made inside of them.
304
304
305
305
*!*
@@ -440,15 +440,15 @@ They are very convenient for simple one-line actions, when we're just too lazy t
440
440
441
441
The examples above took arguments from the left of `=>` and evaluated the right-side expression with them.
442
442
443
-
Sometimes we need something a little bit more complex, like multiple expressions or statements. It is also possible, but we should enclose them in figure brackets. Then use a normal `return` within them.
443
+
Sometimes we need something a little bit more complex, like multiple expressions or statements. It is also possible, but we should enclose them in curly braces. Then use a normal `return` within them.
444
444
445
445
Like this:
446
446
447
447
```js run
448
-
let sum = (a, b) => { // the figure bracket opens a multiline function
448
+
let sum = (a, b) => { // the curly brace opens a multiline function
449
449
let result = a + b;
450
450
*!*
451
-
return result; // if we use figure brackets, use return to get results
451
+
return result; // if we use curly braces, use return to get results
452
452
*/!*
453
453
};
454
454
@@ -476,5 +476,5 @@ So we should use a Function Expression only when a Function Declaration is not f
476
476
477
477
Arrow functions are handy for one-liners. They come in two flavors:
478
478
479
-
1. Without figure brackets: `(...args) => expression` -- the right side is an expression: the function evaluates it and returns the result.
480
-
2. With figure brackets: `(...args) => { body }` -- brackets allow us to write multiple statements inside the function, but we need an explicit `return` to return something.
479
+
1. Without curly braces: `(...args) => expression` -- the right side is an expression: the function evaluates it and returns the result.
480
+
2. With curly braces: `(...args) => { body }` -- brackets allow us to write multiple statements inside the function, but we need an explicit `return` to return something.
0 commit comments