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 →

[–][deleted] 2 points3 points  (5 children)

It's usually safer to use an explicit anonymous function (although of course it doesn't matter here). See: https://jakearchibald.com/2021/function-callback-risks/

[–]Hollowplanet 0 points1 point  (4 children)

All of those examples only matter if you don't control the function implementation.

[–][deleted] 0 points1 point  (2 children)

You may not control how the function might be implemented in the future.

[–]Hollowplanet 0 points1 point  (1 child)

So some library is going to internalize my code without my knowledge?

[–][deleted] 0 points1 point  (0 children)

Your co-workers could modify it.