es6-arrow-functions Flashcards
1
Q
What is the syntax for defining an arrow function?
A
(param1, paramN) => { let a = 1; return a + param1 + paramN; }
2
Q
When an arrow function’s body is left without curly braces, what changes in its functionality?
A
It expects an expression (and not a statement)
It’s going to return a value (if we use curly braces we must add a return)
3
Q
How is the value of this determined within an arrow function?
A
By its surrounding scope.
they execute in the scope they are created (the arrow function definition)