DEV Community

Discussion on: 3 Weird Things You (Probably) Didn't Know You Can Do With The JavaScript Spread Operator πŸ₯³

Collapse
 
adam_cyclones profile image
Adam Crockett πŸŒ€

Thanks for the post Harrison, but there is a part of me that would prefer an object which is missing a property, to instead contain something explicit, like null or better yet a failover. With that said, my way or this way we would still be checking downstream that something is not here OR is null or failover. But mine would not need gork time, maybe πŸ€·β€β™‚οΈ (I'd do something else wierd instead)

Collapse
 
harrison_codes profile image
Harrison Reid

Absolutely - I tend to agree that while there are some cases where this pattern is useful, it’s often better to keep a consistent object schema, and explicitly set the missing properties to null.

As with all things (especially somewhat obscure patterns), use with caution!

Collapse
 
adam_cyclones profile image
Adam Crockett πŸŒ€

It's a hobby to know strange JavaScript, I can relate.

I am also interested in the obscure, checkout my labeled loops post, it's right up there in the do not do this camp.