es6-arrow-functions Flashcards
What is the syntax for defining an arrow function?
let nameOfFunction = (parameters) => expression or {statement}
When an arrow function’s body is left without curly braces, what changes in its functionality?
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 is the value of ‘this’ determined within an arrow function?
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.