MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/1j1cw7/coffeescripts_scoping_is_madness/cbagdl0/?context=3
r/programming • u/donatj • Jul 25 '13
315 comments sorted by
View all comments
Show parent comment
1
So I think the coffescript for that would be:
allDivs.on 'mouseover', () -> button.click () => $(@).html 'You clicked'
Where => binds the 'this' and @ references it. I'm no javascript dev, but why would you want to bind the 'this' of the callback function anyway?
View all comments
Show parent comment
1
u/a_marklar Jul 26 '13
So I think the coffescript for that would be:
Where => binds the 'this' and @ references it. I'm no javascript dev, but why would you want to bind the 'this' of the callback function anyway?