JSFiddle - React, Tailwind, and code Playground
by Julien Etienne
JavaScript
// Bank Account
function BankAccount(){
this.balance = 0;
}
BankAccount.prototype.checkBalance = function(){
this.balance += deposit;
console.log('You have deposited $' + deposit + ' your new balance is $' + this.balance);
}
BankAccount.prototype.deposit = function(deposit){
this.balance += deposit;
}
BankAccount.prototype.withdrawal = function(withdrawal){
this.balance -= withdrawal;
}
// Savings Account
function SavingsAccount(){
this.BankAccount = 0;
BankAccount.call(this);
}
SavingsAccount.prototype = Object.create(BankAccount.prototype);
SavingsAccount.constructor = SavingsAccount;
SavingsAccount.deposit(5000);
SavingsAccount.checkBalance();
/*
// Current Account
function CurrentAccount(){
this.BankAccount = 0;
BankAccount.call(this);
}
SavingsAccount.deposit(5000);
SavingsAccount.checkBalance(); */