DEV Community

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

mattdevio profile image
Matt G

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

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.

kwadoskii profile image
Austin Ofor

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