I want to have a function definition which should contain both Optional and Rest Parameter. While invoking the function, am not getting desired output from the function. While invoking a function should I use some special keyword or something?
In the below function, the address is an optional parameter and names is a Rest Parameter. How can I invoke this function?
function Greet(age:number,address?:string,...names: string[]):void{
console.log(age);
console.log(address);
console.log(names)
}
Greet(20,"Mathan","Maddy")
Here am passing parameters only to age and names. but the second value "Mathan" is getting considered for address in my function.