This is a javascript assignment...Please read carefully! Create a Javascript cus
ID: 3687709 • Letter: T
Question
This is a javascript assignment...Please read carefully!
Create a Javascript custom object for a bank account. The object should know the following information about an account object: Account Number, Owner Name and Balance. Create methods to deposit and withdraw money from the object. Create a form that displays the balance of an account and buttons that deposit to and withdraw from the account in increments of $5. Include updating of the balance display when a deposit or withdrawal is made.
Essentially what I am asking for is that the bank account object be defined as a function, and I need a form that displays the account balance, with a button to deposit $5, and a button to withdraw $5, where the account balance in the form changes accordingly. I thumbs down for incorrect or unusable answers.
Explanation / Answer
var account = function() { var value = 0; return { account_number: " ", account_name : " ", deposit: function ( 5$ ) { value = value + 5$; }, withdrawal: function (5$) { value = value - 5$; }, balance: function( ) { return value; } } }; var account1 = Object.create(account());
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.