SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    38911 Basic Bytes Free johnuk's Avatar
    Join Date
    Jul 2008
    Location
    Somerset, England
    Posts
    459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A way to view Prototype Object's properties in Firebug?

    Hi all,

    Just a curiosity really - is there a simple way of viewing the entire contents of a Function's prototype object including user defined and default properties via Firebug?

    I thought it would be as simple as say:

    var derp = function(){};
    derp.prototype;

    and then clicking on the hyperlink in the left-hand pane but when I click on it, it just shows the constructor and none of the inherited stuff like like toString(), toSource() etc.

    Any ideas? I hope that made sense

  2. #2
    SitePoint Addict
    Join Date
    Nov 2008
    Location
    Thailand
    Posts
    329
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Try having a dig around in chrome's web developer tools instead (F12).

    Example:
    Code:
    var MyObject = function MyObject(){};
    console.log(MyObject);
    console.log(MyObject.prototype);
    
    // Output
    function MyObject(){}
    MyObject
        constructor: function MyObject(){}
            arguments: null
            caller: null
            length: 0
            name: "MyObject"
            prototype: MyObject
            __proto__: function Empty() {}
                apply: function apply() { [native code] }
                arguments: null
                bind: function bind() { [native code] }
                call: function call() { [native code] }
                caller: null
                constructor: function Function() { [native code] }
                length: 0
                name: "Empty"
                toString: function toString() { [native code] }
                __proto__: Object
                <function scope>
             <function scope>
                Global: Window
        __proto__: Object
            __defineGetter__: function __defineGetter__() { [native code] }
            __defineSetter__: function __defineSetter__() { [native code] }
            __lookupGetter__: function __lookupGetter__() { [native code] }
            __lookupSetter__: function __lookupSetter__() { [native code] }
            constructor: function Object() { [native code] }
            hasOwnProperty: function hasOwnProperty() { [native code] }
            isPrototypeOf: function isPrototypeOf() { [native code] }
            propertyIsEnumerable: function propertyIsEnumerable() { [native code] }
            toLocaleString: function toLocaleString() { [native code] }
            toString: function toString() { [native code] }
            valueOf: function valueOf() { [native code] }
            get __proto__: function __proto__() { [native code] }
            set __proto__: function __proto__() { [native code] }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •