Created
September 14, 2017 23:55
-
-
Save ripter/db2ce2430dc03ac3137d2d9b833aba55 to your computer and use it in GitHub Desktop.
Example of Attributes in JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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