/ Published in: JavaScript
Interface
- function(object object_name)
Construct a table of property information describing its index in the table, owner, type, identifier and value.
The result is returned from an anonymous function so the global name space won't be corrupted. A user can also provide a string to be the name of a global variable to store the result table.
BookmarkletThe bookmarklet is generated by Closure Compiler .
Expand |
Embed | Plain Text
/* <bookmarklet> *\ javascript:(function(e){var b,a,f,d,c=[];for(b in e){f=e.hasOwnProperty(b)?"this":"parent";d=typeof a;if(d=="object")d=a==null?"null":a.constructor;a=e[b];c.push([c.length,f,d,b,a]);c.properties.push(b);c.values.push(a)}return c})(); \* </bookmarklet> */ (function(instance) { var property, value, owner, type; var table = []; for (property in instance) { /* Construct the table of property information. */ owner = instance.hasOwnProperty(property) ? "this" : "parent"; type = typeof value; if (type == "object") type = value == null ? "null" : value.constructor; value = instance[property]; table.push([table.length, owner, type, property, value]); /* Store properties. */ table.properties.push(property); /* Store values. */ table.values.push(value); } return table; })();
You need to login to post a comment.
