3 ms·
One of my coworkers made the good suggestion that "that" is only one character away from "this", so we use "self" instead for the same purpose.
by foreigner 10y ago
One of my coworkers made the good suggestion that "that" is only one character away from "this", so we use "self" instead for the same purpose.
- Filligree 10y agoI've always used 'me'. Not for any particular reason, it's just the first name that occurred to me.
- recursive 10y agoFYI this is the keyword that Visual Basic uses as well.
- yathern 10y agoNot to be overly pedantic, but I'm I missing something here? "that" -> "this" is a two character change, no?
- foreigner 10y agoHa ha of course you're right! Math is hard.
- kevin_thibedeau 10y agoBarbie? That you?
- nickserv 10y agoI use 'self' as well, but for me it was because I used Python before JS.
- j79 10y agoIt could get messy if you're doing stuff with Canvas, but I've used "ctx" in the past to denote the context change.
- bjterry 10y ago'self' is also the global variable when you are in a WebWorker context, so it's sort of like overwriting 'window'. When you are in a window context 'self' is also identical with 'window' but people don't usually use it there.
- deleted 10y ago[deleted]