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).
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).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.