MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/9mne4e/writing_lighter_faster_javascript_functions/e7h8mpu/?context=3
r/javascript • u/jsloverr • Oct 09 '18
23 comments sorted by
View all comments
1
Regardless of whether the described methods have any merit, can anyone answer why it was written this way:
const isStooge = (function() { const STOOGES = ['Larry', 'Curly', 'Moe']; return (name) => STOOGES.includes(name); })(); isStooge('Moe'); isStooge('Joe');
And not this way:
const isStooge = (() => { const STOOGES = ['Larry', 'Curly', 'Moe']; return (name) => STOOGES.includes(name); })(); isStooge('Moe'); isStooge('Joe');
Why the mix in function syntax?
2 u/Dynamicic Oct 10 '18 I was thinking the exact same. The inconsistency was triggering my OCD.
2
I was thinking the exact same. The inconsistency was triggering my OCD.
1
u/cLnYze19N Oct 09 '18
Regardless of whether the described methods have any merit, can anyone answer why it was written this way:
And not this way:
Why the mix in function syntax?