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.)

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.)

Answer:



Leave a Reply 3

Your email address will not be published. Required fields are marked *


Fab

Fab

The answer is:

this.loanAmout = 100;
this.loanAmout += 1000;
this.loanAmout += 1000;
myApp.loanAmout

Po

Po

Why did you post this? That’s exactly what the Answer says too.

Syed Ajaz Akhter

Syed Ajaz Akhter

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);