DEV Community

Discussion on: Extract Functions Arguments using Destructure in JavaScript

 
nombrekeff profile image
Keff

I have to agree with you in this sense, I guess the point of the post was to not use arg[0] to access arguments and to show and explain how destructuring works. But in the example you show, it is kinda redundant. I think this will confuse more people than not.

This is why I use objects instead, at least you give some useful feature to the user (named parameters).
This: fn({ name: 'bob' }).
Instead of: fn('bob').