Read more

Don't use "self" as a Javascript variable

Henning Koch
January 12, 2014Software engineer at makandra GmbH

You might sometimes use self to capture the context of this before it is destroyed by some function.

Illustration book lover

Growing Rails Applications in Practice

Check out our e-book. Learn to structure large Ruby on Rails codebases with the tools you already know and love.

  • Introduce design conventions for controllers and user-facing models
  • Create a system for growth
  • Build applications to last
Read more Show archive.org snapshot

Unfortunately self is also an alias for window Show archive.org snapshot , the global top-level object. Save your future self some headaches and use another name like me instead (Coffeescript chose to use _this Show archive.org snapshot ).

Posted by Henning Koch to makandra dev (2014-01-12 09:10)