Created
October 19, 2019 17:50
-
-
Save smarttonna/330345e603d47752ee4a5c80df4262ed to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/jabacuv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
class BankAccount{ | |
constructor(owner,balance){ | |
this.owner = owner; | |
this.balance = balance; | |
} | |
showBalance(amount){ | |
console.log("Balance " + this.balance + "NGN"); | |
} | |
withdraw(amount){ | |
if(this.balance < amount){ | |
console.log("Insufficient Balance"); | |
} | |
else{ | |
this.balance -= amount; | |
this.showBalance(); | |
} | |
} | |
deposite(amount){ | |
this.balance += amount; | |
this.showBalance(); | |
} | |
} | |
const newOwner = new BankAccount("Amazu Tonna",5000); | |
newOwner.withdraw(8000); | |
newOwner.deposite(3000); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">class BankAccount{ | |
constructor(owner,balance){ | |
this.owner = owner; | |
this.balance = balance; | |
} | |
showBalance(amount){ | |
console.log("Balance " + this.balance + "NGN"); | |
} | |
withdraw(amount){ | |
if(this.balance < amount){ | |
console.log("Insufficient Balance"); | |
} | |
else{ | |
this.balance -= amount; | |
this.showBalance(); | |
} | |
} | |
deposite(amount){ | |
this.balance += amount; | |
this.showBalance(); | |
} | |
} | |
const newOwner = new BankAccount("Amazu Tonna",5000); | |
newOwner.withdraw(8000); | |
newOwner.deposite(3000); | |
</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BankAccount{ | |
constructor(owner,balance){ | |
this.owner = owner; | |
this.balance = balance; | |
} | |
showBalance(amount){ | |
console.log("Balance " + this.balance + "NGN"); | |
} | |
withdraw(amount){ | |
if(this.balance < amount){ | |
console.log("Insufficient Balance"); | |
} | |
else{ | |
this.balance -= amount; | |
this.showBalance(); | |
} | |
} | |
deposite(amount){ | |
this.balance += amount; | |
this.showBalance(); | |
} | |
} | |
const newOwner = new BankAccount("Amazu Tonna",5000); | |
newOwner.withdraw(8000); | |
newOwner.deposite(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment