class method Object.inspect
Object.inspect(obj) → String
-
object(Object) – The item to be inspected.
Returns the debug-oriented string representation of the object.
undefinedandnullare represented as such.- Other types are looked up for a
inspectmethod: if there is one, it is used, otherwise, it reverts to thetoStringmethod.
Prototype provides inspect methods for many types, both built-in and library-defined,
such as in String#inspect, Array#inspect, Enumerable#inspect and Hash#inspect,
which attempt to provide most-useful string representations (from a developer's standpoint)
for their respective types.
Examples
Object.inspect();
// -> 'undefined'
Object.inspect(null);
// -> 'null'
Object.inspect(false);
// -> 'false'
Object.inspect([1, 2, 3]);
// -> '[1, 2, 3]'
Object.inspect('hello');
// -> "'hello'"