typescript methods which return code example
Example 1: typescript default parameter
function sayName({ first, last = 'Smith' }: {first: string; last?: string }): void {
const name = first + ' ' + last;
console.log(name);
}
sayName({ first: 'Bob' });
Example 2: function with return type in angular
greet() : number {
return "Hello, " + this.greeting;
}