keys :: Object

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

 

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

 

Note that the order of the resulting Array is browser-dependent (it relies on the for...in loop), and is therefore not guaranteed to follow either declaration or lexicographical order. Sort the array if you wish to guarantee order.

 

Examples

 

Object.keys()

// -> []

 

Object.keys({ name: 'Prototype', version: 1.5 }).sort()

// -> ['name', 'version']

 


Prototype API 1.5.0 - prototypejs.org