Skip to content

Instantly share code, notes, and snippets.

@L3au
Created February 27, 2020 21:28
Show Gist options
  • Save L3au/078eed01afd4dc75cbda6b98e4fe314b to your computer and use it in GitHub Desktop.
Save L3au/078eed01afd4dc75cbda6b98e4fe314b to your computer and use it in GitHub Desktop.
Getting Object Property Descriptors
Open the console in CodePen or in your browser's Developer Tools.
console.clear();
const myDog = {
kind: 'Labradoodle',
color: 'brown',
weight: '70 lbs'
};
console.log(Object.getOwnPropertyDescriptor(myDog, 'kind'));
console.log(Object.getOwnPropertyDescriptor(myDog, 'color'));
console.log(Object.getOwnPropertyDescriptors(myDog));
body {
padding: 20px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment