Solución
solution.tsTypeScript
export function getBalance(initialBalance: number, depositAmount: number): number {
class BankAccount{
private balance:number
constructor(initialBalance:number){
this.balance=initialBalance
}
deposit(amount:number):void{
this.balance+=amount
}
get getBalance():number{
return this.balance
}
}
const newBankAcount=new BankAccount(initialBalance)
newBankAcount.deposit(depositAmount)
return newBankAcount.getBalance
}0respuestas