The scenario is as follows:
function:
const fun = (a="keep this", b="change this")=>{return a + b};
How can I keep the first default parameter and override the second one? I have several functions that use many default parameters that are called in different ways, so just moving the b
param to the first argument will not work. For the sake of simplicity, a
would hypothetically be overridden nearly as often as b
.
I found answers regarding optional parameters but none showed me how to specify parameter while retaining defaults before said parameter.
I tried calling it in a way similar to python with no success:
fun(b="changed");