Skip to content

Instantly share code, notes, and snippets.

@heron2014
Created December 7, 2016 18:06
Show Gist options
  • Save heron2014/488013dcac2d6f25bca45bbf271be0dc to your computer and use it in GitHub Desktop.
Save heron2014/488013dcac2d6f25bca45bbf271be0dc to your computer and use it in GitHub Desktop.
Getting all inherited property names of an object
const getAllInheritedPropNames = (obj) => {
let props = [];
do {
props = props.concat(Object.getOwnPropertyNames(obj));
} while (obj = Object.getPrototypeOf(obj));
return props;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment