DEV Community

loading...

Discussion on: A creative way to have required arguments in JavaScript

Collapse
mattdevio profile image
Matt G

Interesting convention, What happens if you need a default variable though?

Collapse
gabrielrufino profile image
Gabriel Rufino Author

Hey man :D

If you can have default parameters, you don't need to require the variable. If you need to require the parameter, it doesn't make sense to have default parameters.

Collapse
kwadoskii profile image
Austin Ofor

Then the required method is not needed, since the original function always gets an argument parsed to it.