es6-arrow-functions Flashcards

1
Q

What is the syntax for defining an arrow function?

A
(param1, paramN) => {
   let a = 1;
   return a + param1 + paramN;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When an arrow function’s body is left without curly braces, what changes in its functionality?

A

It expects an expression (and not a statement)

It’s going to return a value (if we use curly braces we must add a return)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How is the value of this determined within an arrow function?

A

By its surrounding scope.

they execute in the scope they are created (the arrow function definition)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly