return type function typescipt code example
Example 1: function with return type in angular
greet() : number {
return "Hello, " + this.greeting;
}
Example 2: typescript annotate return type
function add(x: number, y: number): number {
return x + y;
}