Skip to content

Instantly share code, notes, and snippets.

@robotlolita
Created September 19, 2010 01:22
Show Gist options
  • Select an option

  • Save robotlolita/586251 to your computer and use it in GitHub Desktop.

Select an option

Save robotlolita/586251 to your computer and use it in GitHub Desktop.
/**
* Object.keys(object) -> Array of String
*
* List the keys that belongs only to the given object.
**/
(function() {
function list_keys(object) {
var prop
, keys = [];
for (prop in object) {
object.hasOwnProperty(prop) && keys.push(prop);
}
return keys;
}
Object.keys || (Object.keys = list_keys)
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment