Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!uucp.gnuu.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <3363070.6bLXA3eQba@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Sat, 11 Jan 2014 16:37:16 +0100 User-Agent: KNode/4.11.3 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. MIME-Version: 1.0 Lines: 49 NNTP-Posting-Date: 11 Jan 2014 16:37:23 CET NNTP-Posting-Host: c89b36fa.newsspool1.arcor-online.net X-Trace: DXC=HMfMWlBOkUlPKPPVf;4hUjic==]BZ:afn4Fo<]lROoRankgeX?EC@@`BeLlkVT3cfdDZm8W4\YJNlYUVHKH;GI^goE><`M@=jfm40H?IXHnDZb X-Complaints-To: usenet-abuse@arcor.de Xref: csiph.com comp.lang.javascript:22566 Tony Johansson wrote: > The kyword this is always refering to the owner. No, it always evaluates to the “this” value of the execution context. > In this Employee example the owner must be window. No, the new “Employee” instance. > I userstand this for example when I want to change color for this html > control I pass the controlitself to the event handler ChangeColor > onclick="ChangeColor(this)" You have not posted a “ChangeColor” function. > […] > function Employee(first, last) > { > var _firstName = first; > var _lastName = last; > > this.get_FirstName = function () > { > return _firstName; > } > […] > } > > function Foo() This function is probably never called as a constructor (because that would not make sense); avoid the leading capital letter. > { > var emp = new Employee("Nisse", "Hult"); > var name = emp.get_FirstName() + " " + emp.get_LastName(); > […] > } I find your indentation excessive, especially for Usenet; two spaces per level should suffice. YMMV. -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.