http://www.aminutewithbrendan.com/pages/20110303

On Fri, Mar 4, 2011 at 11:07 AM, Nick Morgan <[email protected]> wrote:

>
>
> On 3 March 2011 19:20, Michael Geary <[email protected]> wrote:
>
>> Personally I like to use the same name for the object that I would
>> typically use in code that *uses* the object. For example I might use a
>> variable called 'dialog' for one of your Dialog objects, both in the
>> constructor and elsewhere.
>>
>> The other rule I follow strictly is that if I create a variable for
>> 'this', then I do not use 'this' *at all* other than that one assignment.
>> It's too confusing to mix and match.
>>
>> So, I'd write that code like so:
>>
>> var Dialog = function() {
>>     var dialog = this;
>>     dialog.width = 400;
>>     dialog.setWidth = function( width ) {
>>         dialog.width = width;
>>     }
>> }
>>
>> -Mike
>>
>>
> Absolutely, I think this is the sanest way to deal with `this` issue.
>
> --
> Nick Morgan
> http://skilldrick.co.uk
> @skilldrick <http://twitter.com/skilldrick>
>
>  --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/[email protected]/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe from this group, send email to
> [email protected]
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to