loading...

re: The shortest way to conditional insert properties into an object literal VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Why should I choose the shortest way if it needs an article to be explained? In my opinion, the best code is the self-explanatory one, not the shor...
 

I like this pattern not just because it's the "shortest" but because it's the most declarative. This way, I can construct and assign my object in one place, without going back later to mutate it's contents. I think that leads to better code because it reduces the need to mentally execute each line.

Code of Conduct Report abuse