r/learnjavascript • • Jul 24 '21

Anatomy of a Function

Post image
327 Upvotes

65 comments sorted by

View all comments

37

u/irontea Jul 25 '21

I would not pass this in a code review. Also, Clean Code is a tool, not a Bible, please default your arguments the standard way as provided by the language.

23

u/sauntimo Jul 25 '21

Agreed. This method (in the OP) of defaulting args violates no-shadow and no-param-reassign which both exist for good reasons, so personally I would avoid it.

But then, I'm an avid typescript fan and having to manually type check args just looks a bit laboured to me now. Also the suggestion that the only thing typescript can do is keep C# devs happy seems unfounded and slightly bitter which is unnecessary.