es6-arrow-functions Flashcards
What is the syntax for defining an arrow function?
let func = () => expression or {statement} with func being the name of the arrow function, expression being anything that returns a value and the statement being for functions that don’t need to return values
When an arrow function’s body is left without curly braces, what changes in its functionality?
The expression that is showing is automatically returned, it functions the same as let func = () => {return expression} but it is shorthand: let func = () => expression
How is the value of this determined within an arrow function?
The value of this is the value of this of the containing code block
When is the value of this determined for arrow functions?
The value of this is determined at definition time since it looks out to the containing code block to get its this value