DRAFT
ArrowFunctionRequiresFunctionKeyword
Misconception:
To define an arrow function expression, one has to use the keyword function
before the list of parameters.
Incorrect
Arrow functions also require the keyword 'function'
Correct
Arrow functions do not require the keyword 'function'
CorrectionHere is what's right.
Here is what's right.
Arrow function expressions can be written in different ways depending on the number of parameters and the body.
However, one never has to use the keyword function
before the list of parameters.
OriginWhere could this misconception come from?
Where could this misconception come from?
If one knows about traditional anonymous functions, their syntax prescribes the function
keyword. As arrow functions are often used as a replacement for traditional anonymous functions, students might think that the same function
keyword is required also for arrow functions.