Loading ...
Sorry, an error occurred while loading the content.

41937Re: Execution Scope and Functions/Objects/Classes/etc

Expand Messages
  • Michael Hasenstein
    Dec 4, 2008
    • 0 Attachment
      --- I wrote:

      > So what is my point? Well, if you create an object without a
      > constructor, you don't get the secret link. Therefore it does not
      > inherit anything from a parent object (the constructor function object).


      That sentence I just wrote is wrong - it DOES inherit, ALL objects do, but from the Object object's prototype (the object at the root of the object hierarchy in Javascript). Imagine such objects being created using the "default constructor".

      Example/proof:

      //create object using literal notation
      b = {};

      //only works in Firefox, other browsers have different "secret links"
      b.__proto__=== Object.prototype
      returns "true"
    • Show all 25 messages in this topic