Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Agreed. Much prefer 'var self = this' style. Keep the model transparent for future maintenance.

One time I don't is in Jasmine, where they explicitly state that 'this' is shared across all 'beforeEach', 'it' and 'afterEach' calls. Which backs up your first point.



This is where I've landed with the JavaScript that I write. It keeps things relatively sane, at least better than the other approaches I've tried.


I thought self had gone out of favor due to its relatively new global purpose.


ok, call it something else. I meant to say, save away the current ref to 'this'.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: