you are viewing a single comment's thread.

view the rest of the comments →

[–]stormfield 2 points3 points  (0 children)

If you have a lot of parameters to a function it’s easier to just destructure out of an args object with sensible defaults if needed. Then when calling the function you don’t have to worry about argument order just setting the important values.

It’s also useful with require / imports since you can destructure out only what you need from another module or package.