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?

Message-ID <1611394.rOlob3pHFt@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-06-30 11:06 +0200
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

Followups directed to: comp.lang.javascript

Show all headers | 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