Creates a string representation of the given object or primitive.

This function is valid in v2.13.1 to v2.24.3. This function has been downloaded 59 times.


{*} subject
Object or primitive whose string interpretation will be formulated and returned.
{number=} opt_spaceCount Optional
If given and not 0 this causes non-empty objects and/or arrays to be split onto multiple lines and indented by the amount of spaces given here.


A string representation of subject.

Required Functions

This function directly requires the following functions which are included automatically:

  • entries()
    Gets an array of pairs (array of length 2) indicating all of the keys and values within a given array or object.
  • has()
    Every object descended from Object inherits the hasOwnProperty method. This method can be used to determine whether an object has the specified property as a direct property of that object; unlike the in operator, this method does not check down the object's prototype chain.
  • indexOf()
    Gets the index of a specified target value in a string, array or an object. Unlike Array.prototype.indexOf(), this function works for finding NaN and differentiates between -0 and 0.
  • isValidVarName()
    Determines if a string can be used as a variable name in JavaScript.
  • typeOf()
    Either gets the type of a value or adds a constructor registering its custom type name.