DEV Community

loading...

Discussion on: Breaking Down ES6: Default Parameters

Collapse
torianne02 profile image
Victoria Crawford Author

I definitely understand all of the points you are bringing up. Before jumping into each point, I just want to mention that I am a junior dev learning as I write. I began this series specifically to become more acquainted to the tools introduced by ES6 as that seems to be the popular version on most job descriptions.

Now, as to my thoughts about default parameters...I do think that implementing them in live code could definitely make things messy when trying to make sure arguments are being passed into the function properly. Having to keep in mind the specific order is not entirely easy, and yes, could require more comments and documentation.

As for your last point, I think that really falls on the developer. Being tempted to add more arguments to a function is all preference and self control.

With all that being said, I just learned about using the object spreader (introduced in ES8) for this purpose and it seems like a great tool to use!! Take a look at this article as it may interest you!

Thank you so much for adding to the discussion. :)

Collapse
aleksikauppila profile image
Aleksi Kauppila

That’s cool, we’re all learning every day :) thanks for the link, i’ll check it out. 👍