TL DR I know that you didn’t want to use an object, but modern JavaScript engines work very quickly on creating and deleting objects, as well as with default parameters and parameter destruction, I think the options object is your best option. For more details see "Notes on object transfer (default, destructuring)" below.
You have considered two main parameters (I will make a few notes about the version for transmission in the object below). The third option is to accept the builder template option, but it also involves using an object. You said you didn’t want to do this, but you didn’t say why not. Please note that modern JavaScript engines create and delete objects really, really fast, if this relates to your problem.
Marker Lines
When reading the fourth option, the fourth option appeared:> Bhushan Babar append / prepend idea : instead, you can use marker lines in the argument list to indicate that the next argument, for example:
showNotification("the required parameter", "a", value_for_a, "c", value_for_c);
At first glance, which is not related to creating an object, but on modern JavaScript engines, processing it will create an object that was not otherwise created: arguments , a pseudo-array of passed arguments. Because (or the rest parameter, which also creates the object) is the only reasonable way that you could consume such a thing.
Option on Builder
In this approach, the main function returns a builder with setters for various options, and then the final call "Yes, we are ready", which starts the process (where in the builder, the final call usually creates the final object). Using this would look something like this:
showNotification("the required param") .withA(value_for_a) .withC(value_for_c) .go();
Implementing this is complicated compared to other approaches, but not complicated.
Object transfer notes (default, destructuring)
If you use an object (despite its unwillingness), you can use the default and destructuring parameters to make the object more convenient for working with:
let showNotification = function({a = 1, b = 2, c = 3, d = 4, e = 5, f = 6} = {/*default if no object at all*/a: "foo"}){ console.log(a,b,c,d,e,f); }; showNotification(); showNotification({}); showNotification({a:42});
In the comment you said:
the thing here is all optional except the first parameter
It looks like you probably want the first parameter and then the options object:
let showNotification = function(firstThing, {a = "default_a", b = "default_b"/*etc.*/} = {}) { console.log(firstThing, a, b); };