fixes
This commit is contained in:
parent
c9401b3104
commit
0fcf9f84fa
58 changed files with 673 additions and 643 deletions
|
@ -0,0 +1,17 @@
|
|||
|
||||
```js run
|
||||
function ask(question, yes, no) {
|
||||
if (confirm(question)) yes()
|
||||
else no();
|
||||
}
|
||||
|
||||
ask(
|
||||
"Do you agree?",
|
||||
*!*
|
||||
() => alert("You agreed."),
|
||||
() => alert("You canceled the execution.")
|
||||
*/!*
|
||||
);
|
||||
```
|
||||
|
||||
Looks short and clean, right?
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
# Rewrite with arrow functions
|
||||
|
||||
Replace Function Expressions with arrow functions in the code:
|
||||
|
||||
```js run
|
||||
function ask(question, yes, no) {
|
||||
if (confirm(question)) yes()
|
||||
else no();
|
||||
}
|
||||
|
||||
ask(
|
||||
"Do you agree?",
|
||||
function() { alert("You agreed."); },
|
||||
function() { alert("You canceled the execution."); }
|
||||
);
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue