What’s wrong with this code JavaScript
There is a practice question in SoloLearn that I am not sure what’s wrong with the coding. I have written 2 lines of coding , see follows: Question: The program you are given should calculate the annual income of a given loan. The program takes the loan initial amount and the annual interest percentage as input, then creates the loan object. Complete the function outside the constructor to calculate the annual income, then assign that value to the corresponding field, that you also create, of the constructor in order to execute the given output. Sample Input 15000 20 Sample Output 3000 Coding: 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) { this.amount = amount; this.yearPercent = percent; //my code is here 1 this.yearIncome = calcYearIncome }; function calcYearIncome(amount,percent){ //my coding is here 2 complete the function to calculate yearly income this.yearIncome= amount*percent/100; }