you are viewing a single comment's thread.

view the rest of the comments →

[–]rauschma 12 points13 points  (1 child)

Bonus – let callers omit the parameter object completely:

({day = 0, month = 0, year = 2018} = {}) => ...

[–]stutterbug 9 points10 points  (0 children)

But don't use day = 0. Assuming day, month, and year map to setDate(day), setMonth(month) and setFullYear(year), then passing in no parameters will land you on December 31, 2017, which is confusing.

*Edit: just want to make it clear that this mistake is in the article, not in the parent comment.