Object.assign()
does not work with getters and setters (because it only reads the property values, as explained in this question):
> let a = {}
> Object.defineProperty(a, "foo", {get: () => "bar"})
> a.foo
'bar'
> let b = Object.assign({}, a)
> b.foo
undefined
What are my alternatives to Object.assign
here, if I want to include foo
in b
?