I can use a variety of means to iterate over properties of objects that I've created in JavaScript, e.g.
Object.keys({one: 1, two: 2, three: function() {return 2+1}})
> ["one", "two", "three"]
I am looking for a way to do the same thing, but with built-in objects, like Object, String, Array. I'd like to call something like this:
Object.keys(String)
... and get this output:
> ["length", "fromCharCode", "fromCodePoint", "prototype", etc.]
... where etc. is the list of properties/methods of the String built-in object.
So far I've tried the following, with no luck:
Object.keys(String)
Object.keys(String())
Object.keys(String.prototype)
Object.keys(String.__proto__)
Object.keys(new String())
for (i in String) {...}
They all return an empty array ([]
).