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

1398Re: top of inheritance chain

Expand Messages
  • Douglas Crockford
    Jul 29, 2010
      --- In jslint_com@yahoogroups.com, Mark Volkmann <r.mark.volkmann@...> wrote:
      >
      > I'm a little confused about something that is pretty fundamental in
      > JavaScript. I was thinking that Object is a prototype of every object.
      > That doesn't seem to be the case though. For example, the following
      > code prints "false".
      >
      > var obj = {};
      > print(Object.isPrototypeOf(obj));
      >
      > So every object has the methods of Object, but there doesn't seem to
      > be a reflective way to see how that happens.
      >
      > Likewise, I think of all the wrapper classes like Boolean, Number and
      > String as "inheriting" from Object, but I can't verify that with code.

      {} inherits from Object.prototype.

      Object inherits from Function.prototype because it is a function.

      A string inherits from String.prototype, which inherits from Object.prototype.
    • Show all 8 messages in this topic