Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news1.tnib.de!feed.news.tnib.de!news.tnib.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Jake Jarvis Newsgroups: comp.lang.javascript Subject: Re: JavaScript: Object Definition Extension Date: Tue, 15 Nov 2011 23:35:46 +0100 Lines: 39 Message-ID: <9ig7q2Fj0tU1@mid.uni-berlin.de> References: <887pb7titjugv9u6j6tiv9cjpdv8t6div7@4ax.com> <5d71fb87-8e00-4c50-96db-4ad31589600b@u5g2000vbd.googlegroups.com> <96u2c7lqsl0sg7v34fd99a4294jqrojih7@4ax.com> <6qb5c75u67t4jg60v5ipc11qu6e4d5it0h@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de eUDrsjRAogAbA69IWeUSAATkftrPsGbw1+XTsxy+2p3QwOs98= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 In-Reply-To: <6qb5c75u67t4jg60v5ipc11qu6e4d5it0h@4ax.com> Xref: x330-a1.tempe.blueboxinc.net comp.lang.javascript:8360 On 15.11.2011 19:31, Gene Wirchenko wrote: > On Tue, 15 Nov 2011 15:43:34 +0000, John G Harris > 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? The idea is to have 'this' inside the function you assigned to base refer to a certain value. -- Jake Jarvis