es6-arrow-functions Flashcards

1
Q

What is the syntax for defining an arrow function?

A

The syntax of the arrow function is: let myFunction = (parameters) => { code block }

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 automically outputs the result, if you have curly braces you need to specify that you are returning something

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

Unlike an anonymous function, an arrow function captures the this value of the enclosing context instead of creating its own this context. The value of this is defined based on where the function is defined, instead of at call time. Lexical this

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