Object

Object is used by Prototype as a namespace; that is, it just keeps a few new methods together, which are intended for namespaced access (i.e. starting with “Object.”).

 

For the regular developer (who simply uses Prototype without tweaking it), the most commonly used methods are probably inspect and, to a lesser degree, clone.

 

Advanced users, who wish to create their own objects like Prototype does, or explore objects as if they were hashes, will turn to extend, keys and values.

 


Moduleindex

 

clone

 

Object.clone(obj) -> Object

 

Clones the passed object using shallow copy (copies all the original’s properties to the result).

 

extend

 

Object.extend(dest, src) -> alteredDest

 

Copies all properties from the source to the destination object. Used by Prototype to simulate inheritance (rather statically) by copying to prototypes.

 

inspect

 

Object.inspect(obj) -> String

 

Returns the debug-oriented string representation of the object.

 

keys

 

Object.keys(obj) -> [String...]

 

Treats any object as a Hash and fetches the list of its property names.

 

values

 

Object.values(obj) -> Array

 

Treats any object as a Hash and fetches the list of its property values.

 

toJSON (1.5.1)

 

toJSON() -> String

 

Returns a JSON string.


Prototype API 1.5.0 - prototypejs.org