Last active
July 1, 2016 15:15
-
-
Save johnmmoss/d5daea2afdc6e807438fa826b42c24a7 to your computer and use it in GitHub Desktop.
Creating an object using Object.create
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
| 'use strict' | |
| var monkey = Object.create(Object.prototype, | |
| { | |
| name: { | |
| value: "Hansel", | |
| writable: true, | |
| enumerable: true, | |
| configurable: true | |
| }, | |
| color: { | |
| value: "Brown", | |
| writable: true, | |
| enumerable: true, | |
| configurable: true | |
| } | |
| }); | |
| console.log(monkey.name); // Hansel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment