Javascript Class (ES6 syntax)
They are the syntax sugar which are the way cleaner of explaning Prototype innheritance
class Account {
constructor(name,initialBalance){
this.name=name;
this.balance = initialBalance;
}
deposit(amount){
this.balance += amount;
console.log(`Hello ${this.name} your balanve ${this.balance}`)
}
}
const john = new Account('john',0);
console.log(john)
Comments
Post a Comment