src code

class method Object.inspect

Object.inspect(object) → String
  • object (Object) – The item to be inspected.

Returns the debug-oriented string representation of the object.

undefined and null are represented as such.

Other types are checked for a inspect method. If there is one, it is used; otherwise, it reverts to the toString method.

Prototype provides inspect methods for many types, both built-in and library-defined — among them String, Array, Enumerable and Hash. These attempt to provide useful string representations (from a developer's standpoint) for their respective types.