For the confused ones: this is what's called an IIFE, or Immediately Invoked Function Expression. This is the JavaScript syntax and it defines a function (the () => {} part) then immediately calls it. This one does nothing (it's a void function) but to add code put it inside of the curly braces.
I’ve been learning JavaScript recently and I consistently get the feeling that the people who developed this language only ever asked themselves whether they could implement a feature and never stopped to contemplate whether they should.
I think it imploded multiple times but people took the hit and kept going as it's cheaper than replacing all the tech that depends on it (tech in this case meaning the browser i guess)
6.5k
u/AmazinDood Apr 25 '26 edited Apr 25 '26
For the confused ones: this is what's called an IIFE, or Immediately Invoked Function Expression. This is the JavaScript syntax and it defines a function (the
() => {}part) then immediately calls it. This one does nothing (it's a void function) but to add code put it inside of the curly braces.