4 ms·
> E.g. JS has now two different ways to write functions, with slightly different semantics. Just 2? More like 9: * function expression * function declaration
by rmrfrmrf 9y ago
> E.g. JS has now two different ways to write functions, with slightly different semantics.
Just 2? More like 9:
* function expression
* function declaration
* arrow function (single line, single param)
* arrow function (single line, multiparam)
* arrow function (multiline, single param)
* arrow function (multiline, multiparam)
* object shorthand
* class declaration
* class expression
- Veen 9y agoIt's not just syntactic differences either: they behave differently with regard to whether they're hoisted and the value of this.