بازنویسی Arrow Functionها
در کد زیر function expressionها را با arrow functionها جایگزین کنید:
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."
)
;
}
)
;
function
ask
(
question,
yes,
no
)
{
if
(
confirm
(
question)
)
yes
(
)
;
else
no
(
)
;
}
ask
(
"Do you agree?"
,
(
)
=>
alert
(
"You agreed."
)
,
(
)
=>
alert
(
"You canceled the execution."
)
)
;
کوتاه و تمیز است، مگر نه؟