When we have an object with a numeric property that works as an accumulation. What's the best way to deal the "accumulate/create" case in ES6 javascript? The simplest way would be:
if (obj.foo)) {
obj.foo += value;
}
else {
obj.foo = value;
}
or
obj.foo = obj.foo ? obj.foo + value : value;
ideas to improve this? thanks!