For optimization it is much better to have named functions instead of anonymous functions insider a variable.
I also do a lot of this mistake, but I try to fix it wherever I look.