I know the differences between functions defined by arrow notation vs older/regular function declaration as laid out nicely in this post: Arrow function vs function declaration / expressions: Are they equivalent / exchangeable?.
Namely:
- Arrow functions bind
this
to parent execution context implicitly - Arrow functions cannot be used as constructors
- You can't name function expressions using arrow syntax
- Some other things such as using
arguments
(that I didn't know existed anyway)
In practical terms, is there any difference between using arrow function syntax / older function syntax for IIFEs? i.e.:
(function(context) {...})(this);
VS
((context) => {...})(this);
It doesn't seem like there are...
Also. As mentioned in an answer to: https://stackoverflow.com/a/38951021/3114742, there is mention that IIFEs are bad practice. But I quite like them... Is there a legitimate reason to avoid them?