Skip to content

Instantly share code, notes, and snippets.

@ripter
Created September 14, 2017 23:55
Show Gist options
  • Select an option

  • Save ripter/db2ce2430dc03ac3137d2d9b833aba55 to your computer and use it in GitHub Desktop.

Select an option

Save ripter/db2ce2430dc03ac3137d2d9b833aba55 to your computer and use it in GitHub Desktop.
Example of Attributes in JavaScript
var o = {}; // Creates a new object
// Example of an object property added
// with defineProperty with a data property descriptor
Object.defineProperty(o, 'a', {
value: 37, // attribute name/key is 'value', it's value is 37
writable: true, // attribute name/key is 'writable', it's value is true
enumerable: true, // attribute name/key is 'enumerable', it's value is true
configurable: true, // attribute name/key is 'configurable', it's value is true
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment