I'm trying to inherit default spec properties, such that, when I create specific overwriting values in inheriting specs, I will still have access to (through inheritance) the unmodified spec values:
let default_boltSpec = {
head_diameter: 2,
shaft_diameter: 0.8,
};
Object.freeze(default_boltSpec);
let derivedBoltSpec = Object.create(default_boltSpec);
console.log( "derivedBoltSpec:", derivedBoltSpec );
Object.assign(derivedBoltSpec , {
head_diameter: 1.5,
});
The weird thing is that I seemingly am not allowed to "overwrite" inherited values! How can values that are strictly on the prototype chain in any way interfere with what properties I am allowed to put on my object?
EDIT:
This screenshot shows the effect of running the above code snippet in the Firefox web developer console:
This image reveals that Object.create does not add any properties to the created object. This is in harmony with the documentation.