Why does the JavaScript "writable" property descriptor not forbid any property changes?
For example:
var TheDarkKnight = Object.create(Superhero, {
"name": {
value:"Batman",
writable:"false"
}
});
TheDarkKnight.name; //"Batman";
TheDarkKnight.name = "Superman";
TheDarkKnight.name; //"Superman";
I thought TheDarkKnight.name
should still return "Batman"
after I tried to change it to another value because I set the "writable" property descriptor to false
.
So how to use it in the right way?