DEV Community

Discussion on: JavaScript Code Smells — Functions

Collapse
msucorey profile image
Corey Wofford • Edited on

Great article! For parameters, I would even argue 'rule of 3' applies here and then for expressiveness, destruct the object args inline, i.e. describeFruit = ({ color, size, name }) =>. This will also let you assign defaults expressively (one place for someone to see where/if/what defaults assigned for missing args).

Collapse
aumayeung profile image
John Au-Yeung Author

Thanks.

Destructuring and default parameters are great features that we should use wherever we can.

It's also great that we only need one object parameter and the order doesn't matter.