-
-
Save speg/30abc28a9d83cbf2c8dba897092fd596 to your computer and use it in GitHub Desktop.
Is it possible to change the name printed in the console? What property is the dev tools reading?
This file contains 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
function caat() { this.legs = 4; } | |
// undefined | |
Object.defineProperty(caat.prototype, "name", {value: "cat"}) | |
// Object {name: "cat"} | |
caat | |
// caat() { this.legs = 4; } | |
milo = new caat() | |
// caat {legs: 4} | |
milo | |
// caat {legs: 4} | |
caat.name | |
// "caat" | |
caat.name = 'kitten' | |
// "kitten" | |
caat | |
// caat() { this.legs = 4; } | |
milo | |
// caat {legs: 4} | |
pooky = new caat() | |
// caat {legs: 4} | |
pooky | |
// caat {legs: 4} |
Commenting so I can watch this thread. I'm making a framework and it's frustrating, having every single component named "Component"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also looking for the answer.