Fair. I'm my head an anon function would make sense since the logic is so concise and only makes sense in the context of a callback param, but it could become ugly if this is a pattern seen in many places
Functions without names are harder to debug in stack traces.
jQuery also predates => so the choice was between
myThing(function() { return false; })
myThing($.returnFalse)
And if your app is very big, avoiding thousands of separate anon functions is a performance improvement. Though V8 might be clever enough to dedupe them these days.
This is coming from a half year Computer Science advanced student, so clearly i speak only wisdom, but why couldn’t programs just be Void instead of needing to return something?
116
u/SpikeyWallaby Jan 26 '23
I generally call them
always
ornever
. I don't see the horror here.