Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.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: <1984124.lNXhnOP79H@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Sat, 08 Mar 2014 20:24:01 +0100 User-Agent: KNode/4.11.5 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+&. Supersedes: <12455534.fWAQxJkS7G@PointedEars.de> MIME-Version: 1.0 Lines: 41 NNTP-Posting-Date: 08 Mar 2014 20:24:06 CET NNTP-Posting-Host: 04f0d36f.newsspool2.arcor-online.net X-Trace: DXC=aiB@O?U`A@^\9P[:DUn00QA9EHlD;3YcR4Fo<]lROoRQ8kF I think that when you define a function func, an object called > func.prototype is created, and func's prototype property points to it. Incorrect. Objects have identity, not name (until they are given a naming property). Functions are objects that have a “prototype” property (created upon creation of the Function instance). The initial value of that property is a reference to an Object instance. > But also func has an internal [[prototype]] property which links to > Function.prototype. Function instances have an internal [[Prototype]] property whose value is a reference to the same object as referred to by the initial value of the “Function.prototype” property. > Why? What is the idea behind this process? WLOG, every ECMASCript object has a prototype chain which is identified by the object's internal [[Prototype]] property. But as that property is *internal*, it is not as such available to user code, by contrast to the the “Function.prototype” property whose initial value refers to the same object. So by adding properties to the object referred to by “Function.prototype” aso., you can have all Function instances inherit new properties, especially new methods. There are several applications for this; see e.g. for examples. Different to that, you can add properties to the object referred by the “prototype” property of Function instances; only objects having this object in their prototype chain (in general, objects created by calling this function as constructor) inherit those properties. -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.