Say i have a function like this one in typescript:
openMultipleAddFormModal(commission?: Commission, people?: People): void {
// some data
}
As of my understanding i added the Optional Chaining
operator to make a parameter non necessary.
How do i change my code above to have something like this?
this.openMultipleAddFormModal(res); // where res here refers to people and NOT to commission
Can i do something like c# does, where you can provide the name of the parameter when calling the function and "binding" that to the property?
Something like this in C#:
// main method
public void UpdateBase(string machineRef = null, string userRef = null){
Ref = machineRef ?? Environment.MachineName;
UserRef = userRef ?? Environment.UserName;
}
// and then i specify the parameter i am passing
UpdateBase(userRef: userRef); // is there something like this in typescript / javascript?
Thanks for any help!