Copyright © tutorialspoint.com

# Prototype Basic Object

Object is used by Prototype as a namespace and to call related function using Object object. This is used in following two ways:

- If you are a simple developer then you can use existing functions like inspect or clone.

- If you are one who wishes to create their own objects like Prototype does, or explore objects as if they were hashes, will turn to extend, keys and values.

# Prototype Object Methods:

NOTE: Make sure you have at least version 1.6 of prototype.js.

Methods | Description
--- | ---
clone() | Clones the passed object using shallow copy (copies all the original's properties to the result).
extend() | Copies all properties from the source to the destination object.
inspect() | Returns the debug-oriented string representation of the object.
isArray () | Returns true if obj is an array, false otherwise.
isElement() | Returns true if obj is a DOM node of type 1, false otherwise.
isFunction() | Returns true if obj is of type function, false otherwise.
isHash() | Returns true if obj is an instance of the Hash class, false otherwise.
isNumber() | Returns true if obj is of type number, false otherwise.
isString() | Returns true if obj is of type string, false otherwise.
isUndefined() | Returns true if obj is of type undefined, false otherwise.
keys() | Treats any object as a Hash and fetches the list of its property names.
toHTML() | Returns the return value of obj's toHTML method if it exists, else runs obj through String.interpret.
toJSON() | Returns a JSON string.
toQueryString() | Turns an object into its URL-encoded query string representation.
values() | Treats any object as a Hash and fetches the list of its property values.

Copyright © tutorialspoint.com