Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions 1-js/02-first-steps/17-arrow-functions-basics/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It's called "arrow functions", because it looks like this:
let func = (arg1, arg2, ..., argN) => expression;
```

This creates a function `func` that accepts arguments `arg1..argN`, then evaluates the `expression` on the right side with their use and returns its result.
This creates a function `func` with parameters `arg1..argN`, then evaluates the `expression` on the right side with their use and returns its result.

In other words, it's the shorter version of:

Expand All @@ -33,9 +33,9 @@ let sum = function(a, b) {
alert( sum(1, 2) ); // 3
```

As you can see, `(a, b) => a + b` means a function that accepts two arguments named `a` and `b`. Upon the execution, it evaluates the expression `a + b` and returns the result.
As you can see, `(a, b) => a + b` means a function that defines two parameters named `a` and `b`. Upon the execution, it evaluates the expression `a + b` and returns the result.

- If we have only one argument, then parentheses around parameters can be omitted, making that even shorter.
- If we have only one parameter, then parentheses around it can be omitted, making that even shorter.

For example:

Expand All @@ -48,7 +48,7 @@ As you can see, `(a, b) => a + b` means a function that accepts two arguments na
alert( double(3) ); // 6
```

- If there are no arguments, parentheses are empty, but they must be present:
- If there are no parameters, parentheses are empty, but they must be present:

```js run
let sayHi = () => alert("Hello!");
Expand Down