MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/a6txtp/coming_from_python_to_js/ebyvm3o
r/javascript • u/chroner • Dec 16 '18
const print = console.log
I found my safe space.
156 comments sorted by
View all comments
Show parent comments
0
There's a dude at my work who did this in production code.
self = this
16 u/_xiphiaz Dec 17 '18 This used to be super common when creating JavaScript libraries before modules and arrow functions; it was used to maintain a reference to the parent scope for use within a callback function 2 u/spazz_monkey Dec 17 '18 Fair enough, I assumed it was coz he loves python 1 u/alejalapeno Dec 17 '18 I prefer(ed) _this = this 1 u/fluxxis Dec 17 '18 Such a thisish behavior!
16
This used to be super common when creating JavaScript libraries before modules and arrow functions; it was used to maintain a reference to the parent scope for use within a callback function
2 u/spazz_monkey Dec 17 '18 Fair enough, I assumed it was coz he loves python 1 u/alejalapeno Dec 17 '18 I prefer(ed) _this = this
2
Fair enough, I assumed it was coz he loves python
1
I prefer(ed) _this = this
_this = this
Such a thisish behavior!
0
u/spazz_monkey Dec 17 '18
There's a dude at my work who did this in production code.
self = this