DRAG DROP
You are creating a function by using JavaScript.
You have the following requirements:
The function must display loan amounts to the user within the following HTML element:
<div id=”display”></div>
The loan amount of 2100 must display in the HTML element.
All declared variables and functions must be scoped to the myApp variable.
You need to implement the function.
How should you complete the relevant code? (To answer, drag the appropriate code segments to
the correct location or locations in the answer area. Use only code segments that apply.)
How should you complete the relevant code?
DRAG DROP
You are creating a function by using JavaScript.
You have the following requirements:
The function must display loan amounts to the user within the following HTML element:
<div id=”display”></div>
The loan amount of 2100 must display in the HTML element.
All declared variables and functions must be scoped to the myApp variable.
You need to implement the function.
How should you complete the relevant code? (To answer, drag the appropriate code segments to
the correct location or locations in the answer area. Use only code segments that apply.)
The answer is:
this.loanAmout = 100;
this.loanAmout += 1000;
this.loanAmout += 1000;
myApp.loanAmout
Why did you post this? That’s exactly what the Answer says too.
var loanAmount = 0;
var myApp = {};
(function () {
loanAmount = 100;
this.display = function (value) {
document.getElementById(“display”).innerHTML += value;
};
this.increaseLoanAmount = function () {
loanAmount += 1000;
return;
};
this.increaseLoanAmountAgain = function () {
loanAmount += 1000;
return
};
}).apply(myApp);
myApp.increaseLoanAmount();
myApp.increaseLoanAmountAgain();
myApp.display(loanAmount);