the object whose inherited keys are to be listed.
the inheritance depth until which the function will accumulate keys for.
A
is provided as the depth
,
then all inherited keys up until A
is reached in the inheritance chain will be collected, but not including the keys of A
.N
is provided as the depth
,
then the function will collect keys from N
number of prototypes up the inheritance chain.
0
would imply no traversal.1
would only traverse the first direct prototype of obj
(i.e. getOwnPropertyKeys(Object.getPrototypeOf(obj))
).an array of keys that the object has inherited (string or symbolic keys).
get all inherited list of keys (string keys and symbol keys) of an object, up till a certain
depth
.directly owned keys will not be returned. for that, you should use the getOwnPropertyKeys function.
the optional
depth
parameter lets you control how deep you'd like to go collecting the inherited keys.Default Value
Object.prototype
Example