Y
Hacker News
new
|
ask
|
show
|
jobs
by
tracker1
3263 days ago
In those cases, I usually use
Object.assign(acc, { [prop]:value })
While not sure if `[prop]` is better or worse than not creating a new interstitial object.
1 comments
v413
3263 days ago
why not just use acc[prop] = value ?
link
elmigranto
3262 days ago
Assignment does not return `acc`.
link