es6-arrow-functions Flashcards

1
Q

What is the syntax for defining an arrow function?

A

(parameters) => { statements }

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

When an arrow function’s body is left without curly braces, the function will automatically return the value of the expression that follows the arrow.

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

the value of this is determined by the context in which the function is defined. It is determined by the value of this in the scope that the arrow function is defined in. If the arrow function is defined inside of another function, this will refer to the same value as the outer function’s this. If the arrow function is defined in the global scope, this will refer to the global object.

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