And the famous answer is: it depends. Depends on the use case.
If the parameters are optional, you may use a single parameter (generally named options
) to receive and conditionally Object.assign
the default values (mostly used in pre-ES6 code, but still has its use).
jQuery uses this approach in lots of functions. Here's an example from Angular's $http.get:
// No params
$http.get('https://httpbin.org/get');
// Optional params