DEV Community

Discussion on: The shortest way to conditional insert properties into an object literal

Collapse
 
jfet97 profile image
Andrea Simone Costa

I've already expressed mine opinion here around, and to be technically precise the code is easily testable as any if construct.
Thanks for sharing your opinion!

Collapse
 
klikas profile image
theodoros klikas

I do find the article helpful but to be honest with you, it was the first time I saw something like this.

I guess someone that is more experienced with the spread operator and augmenting objects in this way might have seen it more than me.

As you said, it is most probably a matter of opinion as a lot of things in javascript are those days, for example, I find something like this pretty hard to read:

let adder = (x) => (y, z) => x + y + z;

compared to the old-style alternative but there are people who love it.

So thank you again for going deep in your explanation :)

Thread Thread
 
jfet97 profile image
Andrea Simone Costa

You're welcome!