2 ms·
A simple heuristic I use is to use arrow functions for inline function arguments, and named "function" functions for all others. One reason is exactly what the
by nosianu 2y ago
A simple heuristic I use is to use arrow functions for inline function arguments, and named "function" functions for all others.
One reason is exactly what the subject of discussion is here, it's easier to string-search with that keyword in front of the name, but I don't need that for trivial inline functions (whenever I do I make it an actual function that I declare normally and not inline).
Then there's the different handling of "this", depending on how you write your code this may be an important reason to use an arrow function in some places.