Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #8360

Re: JavaScript: Object Definition Extension

From Jake Jarvis <pig_in_shoes@yahoo.com>
Newsgroups comp.lang.javascript
Subject Re: JavaScript: Object Definition Extension
Date 2011-11-15 23:35 +0100
Message-ID <9ig7q2Fj0tU1@mid.uni-berlin.de> (permalink)
References (3 earlier) <cdvrb7d6ijld51jl1jd2hfksmf8vae95i4@4ax.com> <YuSnExEkLqvOFw7y@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD> <96u2c7lqsl0sg7v34fd99a4294jqrojih7@4ax.com> <GO8h8OImiowOFwDj@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD> <6qb5c75u67t4jg60v5ipc11qu6e4d5it0h@4ax.com>

Show all headers | View raw


On 15.11.2011 19:31, Gene Wirchenko wrote:
> On Tue, 15 Nov 2011 15:43:34 +0000, John G Harris
> <john@nospam.demon.co.uk>  wrote:
>
> [snip]
>
>> However, back when I was writing my javascript note 'call' was new and
>> not in all popular browsers so an older clumsier way was needed.
>> Remember that if you do  a.b()  then the function b is called with the
>> 'this' value set to a. So, we create a property of the Commercial object
>> under construction with the name 'base' (because that's what Netscape
>
>       My question is why a property.  Why not just
>            var base=...
>
>> called it and there isn't a really better name), and use it to hold the
>
>       As there could be multiple levels, "base" is potentially
> confusing.  Visual FoxPro uses "parent".
>
>> function object RealEstate. Now it's easy :
>>
>>   this.base(PropertyLocation, PropertyValue);
>>     // 'this' is the new Commercial object
>>
>> After using it you delete the temporary property 'base' because it's no
>> use for any other job.
>
>       But if you had declared it with var, you would not need to do
> this.
>
>       What am I missing about base's definition?
<snip>

The idea is to have 'this' inside the function you assigned to base
refer to a certain value.

-- 
Jake Jarvis

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

JavaScript: Object Definition Extension Gene Wirchenko <genew@ocis.net> - 2011-11-10 20:02 -0800
  Re: JavaScript: Object Definition Extension "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-11-11 08:49 +0000
  Re: JavaScript: Object Definition Extension beegee <bgulian@gmail.com> - 2011-11-11 05:40 -0800
    Re: JavaScript: Object Definition Extension John G Harris <john@nospam.demon.co.uk> - 2011-11-11 20:11 +0000
      Re: JavaScript: Object Definition Extension Gene Wirchenko <genew@ocis.net> - 2011-11-11 21:02 -0800
        Re: JavaScript: Object Definition Extension John G Harris <john@nospam.demon.co.uk> - 2011-11-12 16:46 +0000
          Re: JavaScript: Object Definition Extension Gene Wirchenko <genew@ocis.net> - 2011-11-14 12:26 -0800
            Re: JavaScript: Object Definition Extension beegee <bgulian@gmail.com> - 2011-11-15 06:49 -0800
              Re: JavaScript: Object Definition Extension beegee <bgulian@gmail.com> - 2011-11-15 09:47 -0800
            Re: JavaScript: Object Definition Extension John G Harris <john@nospam.demon.co.uk> - 2011-11-15 15:43 +0000
              Re: JavaScript: Object Definition Extension Gene Wirchenko <genew@ocis.net> - 2011-11-15 10:31 -0800
                Re: JavaScript: Object Definition Extension Jake Jarvis <pig_in_shoes@yahoo.com> - 2011-11-15 23:35 +0100
                Re: JavaScript: Object Definition Extension John G Harris <john@nospam.demon.co.uk> - 2011-11-16 20:42 +0000
      Re: JavaScript: Object Definition Extension beegee <bgulian@gmail.com> - 2011-11-12 09:35 -0800
        Re: JavaScript: Object Definition Extension John G Harris <john@nospam.demon.co.uk> - 2011-11-13 11:40 +0000
          Re: JavaScript: Object Definition Extension beegee <bgulian@gmail.com> - 2011-11-13 11:53 -0800
            Re: JavaScript: Object Definition Extension John G Harris <john@nospam.demon.co.uk> - 2011-11-14 16:19 +0000
              Re: JavaScript: Object Definition Extension beegee <bgulian@gmail.com> - 2011-11-15 10:02 -0800
  Re: JavaScript: Object Definition Extension Elegie <elegie@anonymous.invalid> - 2011-11-12 12:53 +0100
    Re: JavaScript: Object Definition Extension Denis McMahon <denismfmcmahon@gmail.com> - 2011-11-12 16:04 +0000
      Re: JavaScript: Object Definition Extension John G Harris <john@nospam.demon.co.uk> - 2011-11-12 18:14 +0000
        Re: JavaScript: Object Definition Extension Denis McMahon <denismfmcmahon@gmail.com> - 2011-11-13 19:34 +0000
      Re: JavaScript: Object Definition Extension Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-12 19:31 +0100
      Re: JavaScript: Object Definition Extension Gene Wirchenko <genew@ocis.net> - 2011-11-13 20:33 -0800
    Re: JavaScript: Object Definition Extension John G Harris <john@nospam.demon.co.uk> - 2011-11-12 16:52 +0000
      Re: JavaScript: Object Definition Extension Elegie <elegie@anonymous.invalid> - 2011-11-12 20:49 +0100
        Re: JavaScript: Object Definition Extension Gene Wirchenko <genew@ocis.net> - 2011-11-13 20:21 -0800
          Re: JavaScript: Object Definition Extension Elegie <elegie@anonymous.invalid> - 2011-11-14 10:20 +0100

csiph-web