es6-arrow-functions Flashcards

1
Q

What is the syntax for defining an arrow function?

A

let nameOfFunction = (parameters) => expression or {statement}

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

If the body contains a single expression, the omission of curly braces does not affect its functionality.
If the body contains a statement, you must surround it with curly braces.
If the body is a multi-line code block, you include the curly braces.

and

The body automatically returns the value if there are no curly braces.

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 within an arrow function by looking at its enclosing context as opposed to creating its own context like a function defined using the ‘function’ keyword.

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