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


Groups > comp.lang.javascript > #14782

Re: why is this function used in conjunction with Object.create?

Path csiph.com!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="ISO-8859-1"
Message-ID <1611394.rOlob3pHFt@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Organization PointedEars Software (PES)
Date Sat, 30 Jun 2012 11:06:37 +0200
User-Agent KNode/4.4.11
Content-Transfer-Encoding 7Bit
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Subject Re: why is this function used in conjunction with Object.create?
Newsgroups comp.lang.javascript
References <a5d2849f-7e1d-45a4-9eb6-2d3b8eb4e820@googlegroups.com> <V7o0z0Hsiy6PFw2w@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD> <4feb4b76$0$6946$e4fe514c@news2.news.xs4all.nl> <2b1b8713-c63e-4edd-9c8c-3f1f3956706f@googlegroups.com> <jsfsqp$rle$1@news.albasani.net>
Followup-To comp.lang.javascript
MIME-Version 1.0
Lines 47
NNTP-Posting-Date 30 Jun 2012 11:06:37 CEST
NNTP-Posting-Host a13da04e.newsspool3.arcor-online.net
X-Trace DXC=io4YKX0B3KLj7E:bke<5HFMcF=Q^Z^V3H4Fo<]lROoRA8kF<OcfhCOKln[0CFce16JDZm8W4\YJNLR=i2=[N6Y6J`>8j@j>Ak6K0?iY9SZRi@O
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.javascript:14782

Followups directed to: comp.lang.javascript

Show key headers only | View raw


Andreas Bergmaier wrote:

> von kristoff schrieb:
>>>> if (typeof Object.create !== "function") {
>>>>         Object.create = function (o) {
>>>>             function F() {}
>>>>             F.prototype = o;
>>>>             return new F();
>>>>         };
>>>>     }
>>
>> ... but my javascript version allows me to write it without having to
>> declare that function...
> 
> That just means you're one of the lucky. For those with older browsers
> and javascript versions that don't support it (then typeof Object.create

There is no javascript.  This feature was first specified in ECMAScript 
Edition 5:

<http://ecma-international.org/ecma-262/5.1/#sec-15.2.3.5>

(There is the value of fragment-linking the section number to the section 
itself: easy referencing.)

> is not "function", but "undefined"), this snippets adds (a part of) the
> functionality of the native Object.create (see also
> 
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/create/).

And here, e.g.:

<http://msdn.microsoft.com/en-us/library/ff925952(VS.94).aspx>
<http://www.opera.com/docs/specs/presto2.11/ecmascript/>

(I wonder, is there a deal or allowance between Oracle and its competitors 
that the latter can legally use the JavaScript trademark now?  It used to be 
Microsoft *JScript* for legal reasons, but Microsoft's is still a different 
ECMAScript implementation than Netscape/Mozilla.org JavaScript.  Same for 
Opera ECMAScript etc.)


PointedEars
-- 
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
  -- Richard Cornford, cljs, <cife6q$253$1$8300dec7@news.demon.co.uk> (2004)

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


Thread

why is this function used in conjunction with Object.create? von kristoff <mrjcnicolas@gmail.com> - 2012-06-27 08:09 -0700
  Re: why is this function used in conjunction with Object.create? John G Harris <john@nospam.demon.co.uk> - 2012-06-27 16:37 +0100
    Re: why is this function used in conjunction with Object.create? "Tom de Neef" <tdeneef@qolor.nl> - 2012-06-27 20:04 +0200
      Re: why is this function used in conjunction with Object.create? von kristoff <mrjcnicolas@gmail.com> - 2012-06-27 11:50 -0700
        Re: why is this function used in conjunction with Object.create? Andreas Bergmaier <andber93@web.de> - 2012-06-27 23:09 +0200
          Re: why is this function used in conjunction with Object.create? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-06-30 11:06 +0200
      Re: why is this function used in conjunction with Object.create? John G Harris <john@nospam.demon.co.uk> - 2012-06-28 11:10 +0100
  Re: why is this function used in conjunction with Object.create? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2012-06-29 16:25 -0700

csiph-web