From 432dd6120882c0f93e77ce0fa3690c85160fc286 Mon Sep 17 00:00:00 2001 From: Paolo Carrasco Date: Fri, 15 Nov 2013 23:05:09 -0200 Subject: [PATCH] removing the attachment to the 'this' object of the private properties --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 32225f1d18..c1171298eb 100644 --- a/README.md +++ b/README.md @@ -1044,15 +1044,15 @@ }); ``` - - Use a leading underscore `_` when naming private properties + - Use a leading underscore `_` when naming private properties ([When a member is private?](http://javascript.crockford.com/private.html)) ```javascript // bad - this.__firstName__ = 'Panda'; - this.firstName_ = 'Panda'; + var __firstName__ = 'Panda'; + var firstName_ = 'Panda'; // good - this._firstName = 'Panda'; + var _firstName = 'Panda'; ``` - When saving a reference to `this` use `_this`.