I get that, but just because you can do something more painfully doesn't mean that it can't be done simpler. On top of that, there is no assignment of the weapon key.
I think it can be argued that { ...hero, weapon: "sword"} is easier to read than Object.assign({}, hero, {weapon:"sword")
yes I agree that spread is easier to read than Object.assign().. so are you saying that it doesn't have to be as painful as looping through the keys but rather Object.assign is there and if you want to improve on that use spread syntax?
I get that, but just because you can do something more painfully doesn't mean that it can't be done simpler. On top of that, there is no assignment of the weapon key.
I think it can be argued that
{ ...hero, weapon: "sword"}
is easier to read thanObject.assign({}, hero, {weapon:"sword")
yes I agree that spread is easier to read than Object.assign().. so are you saying that it doesn't have to be as painful as looping through the keys but rather Object.assign is there and if you want to improve on that use spread syntax?
I think that is fair to say. Since prior to browser support that was what the transpilers often did for you.