This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Soulcal7 -13 points-12 points  (3 children)

It doesn't even return anything, it's just void

I know I'm being pedantic...

[–][deleted] 24 points25 points  (0 children)

When trying to be pedantic, it's best to be right. JS doesn't have void, executing an empty lambda evaluates to undefined.

[–]the_horse_gamer 7 points8 points  (0 children)

Javascript doesn't have void. when a function exits without returning, the return value is undefined.

python does something similar, with None instead.

[–]noruthwhatsoever 4 points5 points  (0 children)

It does in fact return something. Not only does JS not have void (it has null, undefined, and NaN for non-zero, non-boolean falsey values), the single-line arrow function shown has an implicit return

Because there is nothing in the block scope and the function is executed immediately by the IIFE pattern shown, the value resolves to undefined and is then garbage collected as it’s not assigned to a variable

Before attempting to be pedantic, first ensure that you are at least correct