how to pass not mandatory param in function angular code example
Example 1: how to make a parameter optional in typescript
// Optional parameter
function foo(x?: number) {
console.log("x : "+ x);
}
foo();
foo(6);
Example 2: typescript make function argument optional
function multiply(a: number, b: number, c?: number): number {
if (typeof c !== 'undefined') {
return a * b * c;
}
return a * b;
}