I wrote a component like below:
export class AppComponent {
public num1: number = 2;
public num2: number = 3;
public sum: number = 0;
public add() {
this.sum = this.num1 + this.num2;
}
}
For this, I'm getting sum as 23 instead of 5. Give me a proper solution to do addition. I will be glad to know the answer