Skip to content

Instantly share code, notes, and snippets.

@ceme
Created December 6, 2012 20:18
Show Gist options
  • Save ceme/4227957 to your computer and use it in GitHub Desktop.
Save ceme/4227957 to your computer and use it in GitHub Desktop.
Javascript usage of getOwnPropertyNames
Object.getOwnPropertyNames(Function).sort(); //returns ["arguments", "caller", "length", "name", "prototype"]
Object.getOwnPropertyNames(Function.prototype).sort(); //returns ["apply", "arguments", "bind", "call", "caller", "constructor", "isGenerator", "length", "name", "toSource", "toString", "wtbind"]
var x = {};
x.foo = "foo";
x.bar = "bar";
Object.getOwnPropertyNames(x); //returns ["foo", "bar"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment