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

Popular posts from this blog

Form Part 2

Event mini project by Thapa#33

De-mystifying 'this' keyword of Javascript