- Create a Function constructor that creates Bank Accounts
- Implement the following prototype methods:
deposit: will deposit an amount to the current balance
withdraw: will withdraw an amount from the current balance and return the withdrawn amount
- Validation rules include:
- 2.2.1. Amount must not be negative number
- 2.2.2. Amount must be of type Number
- 2.2.3. Amount must not exceed current balance
getBalance: will return the current balance
- Automatically give a new IBAN number to new accounts. (Static property)
const newAccount = new Account( "Kostas Minaidis" ); // New account created for: Kostas Minaidis // IBAN: GR00010003 newAccount.getBalance() // 0 newAccount.deposit( 100 ) newAccount.getBalance() // 100 newAccount.withdraw( 50 ) newAccount.getBalance() // 50 newAccount.withdraw( 500 ) // Error 'Insufficient balance!' newAccount.withdraw( "50" ) // Error 'Invalid amount' newAccount.withdraw( -150 ) // Error 'Invalid amount'
Create a new repo named
js-prototype, add your instructor(s) as collaborator(s) and submit its URL.
0 of 1 Questions completed
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
0 of 1 Questions answered correctly
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Submit your GitHub URL
Grading can be reviewed and adjusted.Grading can be reviewed and adjusted.
This response will be awarded full points automatically, but it can be reviewed and adjusted after submission.