Object.prototype.inspect ?

Jason Orendorff jason.orendorff at gmail.com
Tue Mar 10 16:01:56 PDT 2009


On Sat, Mar 7, 2009 at 9:18 PM, Tobie Langel <tobie.langel at gmail.com> wrote:
> The lack of a more developer-friendly representation of objects than the one
> obtained through their toString method (or by calling
> Object.prototype.toString) made me long for an ES equivalent of Ruby's
> inspect instance method.

You could use JSON.stringify(obj), which is on track to be
standardized in ES3.1.

(SpiderMonkey has the nonstandard uneval, as well as
Object.prototype.toSource, which I think are a bit closer to what you
want.)

-j


More information about the Es-discuss mailing list