I am fairly new to javascript development and still learning concepts. I have a question regarding the spread "operator" (...).
Can it be used as an inheritance-like mechanism or does it have side effects that should make me avoid this ?
Example
const A = {
prop1: "value1",
prop2: function() {return this.prop1}
}
const B = {
...A,
prop1: "updated_value1",
prop3: "value3"
}
B here can be seen has being inherited from A, A.prop2() returns value1, and B.prop2() returns updated_value1 has one would expect from any inherited object.
Is this valid ?