I have an object that has a constructor with an optional parameter like this:
class example{
constructor(a,b,c,d?){
...
}
}
I want to pass the parameter d only if it exists, and I hope I don’t have to do an if that checks this, because if I have more optional parameters it can get complicated. Is there a way in javascript/typescript to do this. Something like:
new example(
A,
B,
C,
D?
)