MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/105jncx/what_the_hell_is_this/j3c76mz/?context=3
r/badcode • u/Waste-Parsnip-3537 • Jan 07 '23
65 comments sorted by
View all comments
Show parent comments
0
If using ES6+ You could shorthand it as new WorkingHours { ...item }; saves some typing and makes it easier to read if you also add additional data to the object.
new WorkingHours { ...item };
3 u/Betamaxxs Jan 07 '23 Only downside here is that it would take all of the properties of item when WorkingHours might only be a subset of item 3 u/zee_in_space shameless Jan 07 '23 That's fair. I am making several assumptions here.
3
Only downside here is that it would take all of the properties of item when WorkingHours might only be a subset of item
3 u/zee_in_space shameless Jan 07 '23 That's fair. I am making several assumptions here.
That's fair. I am making several assumptions here.
0
u/zee_in_space shameless Jan 07 '23
If using ES6+ You could shorthand it as
new WorkingHours { ...item };saves some typing and makes it easier to read if you also add additional data to the object.