Created
December 6, 2012 20:18
-
-
Save ceme/4227957 to your computer and use it in GitHub Desktop.
Javascript usage of getOwnPropertyNames
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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