4 ms·
JavaScript: This is a trap, avoid it
- bfred_it 12y agoI wrote this short article about "this" in the hope to make code more readable and save you from debugging time. Feel free to comment on it here or call BS. I'm here to learn. :)
- ubertaco 12y agoDepends on your team's conventions. I started doing this on a team where "var self = this" was the convention (lots of Backbone code), so to the rest of my team, "var view = this;" et. al were actually less readable (because they broke the reader's expectations).