I am creating a project that defines the following class:
class BankAccount {
constructor(balance=0){
this.balance = balance;
}
withdraw(amount){
if(this.balance - amount >= BankAccount.overdraftlimit){
this.balance -= amount;
}
}
}
BankAccount.overdraftlimit = -500;
My question here is about the definition of the property overdraftlimit
Is this the best way to define let's call a global property?
Or should be better to define it inside the constructor like
this.overdraftlimit = -500;
Thank you!!
overdraftlimit? should a bank account be able to mutate it?