Can someone please help me with this challenge.The loan needs to be calculated. Amount is 15000 and percent is 20.
function main() { //get the initial amount and the interest percentage var amount = parseInt(readLine(),10); var yearPercent = parseInt(readLine(),10); var loan1 = new Loan(amount, yearPercent); //output to console console.log(loan1.yearIncome()); } function Loan(amount, percent, yearIncome) { this.amount = amount; this.yearPercent = percent; //your code goes here this.yearIncome = function() { this.yearIncome = calcYearIncome() } }; function calcYearIncome(amount,percent,yearIncome){ //complete the function to calculate yearly income this.amount = amount; this.yearPercent = percent; this.yearIncome = function(amount,percent){ return this.percent /100 * this.amount; } } This returns undefined