Write a class BankAccount and its subclass SavingsAccount.
BankAccount:
new BankAccount(owner, balance). owner is a string, balance is a number that is 0 or more. If balance is not passed, it is 0.owner returns the owner, a getter balance returns the current balance.balance: account.balance = 500 must not change the balance. Only deposit and withdraw change it.deposit(amount) adds amount to the balance and returns the new balance.withdraw(amount) takes amount from the balance and returns the new balance. You can take the whole balance (the result is 0). If amount is greater than the balance, throw new Error('Insufficient funds'). It is a plain Error object, not a RangeError and not a string.amount is 0 or negative, deposit and withdraw throw a RangeError (any message).SavingsAccount:
BankAccount with extends. Constructor: new SavingsAccount(owner, balance, rate), where rate is a percent, 0 or more (for example 5 means 5%). Call the parent constructor with super.owner, balance, deposit and withdraw come from BankAccount. Do not write them again in SavingsAccount.addInterest() adds balance * rate / 100 to the balance (not rounded) and returns the new balance. If this interest is 0 (rate 0 or balance 0), the balance stays the same and there is no error.Every account keeps its own balance: a change in one account does not change another.
new BankAccount('Ann', 100).deposit(50)Returns 150
new BankAccount('Bob').balanceReturns 0
new SavingsAccount('Kate', 1000, 5).addInterest()Returns 1050
Hidden tests run on Submit.