Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
brbcoding
· 12y ago · 0 comments
What would a better alternative be for `var self = this` ? I use it all the time, never thought of it as an anti-pattern as long as it's only declared where you actually need it.
Comments
[–]
jasonlotito
12y ago
> What would a better alternative be for `var self = this` ?
function foo(){}; setTimeout(foo.bind(this),1000);
That being said, I'm not entirely crazy about that method as well.
[–]
prezjordan
12y ago
A billion binds on every nested function you see. It's gross :)