01
Project Challenge
Objective
I developed the loan calculator as a way of exploring the DOM. I used the getelementID method to retrieve the loan-form ID while also adding an addeventlistener method to listen for the submit request. This hides the results and displays a loading screen as calculations are completed.
I developed a calculateResults method by combining a getElementById method for each element. I then used the parsefloat function that accepts a string and converts it into a floating point number. To declare a principle variable that is the total loan amount. Total calculated interest and finally payments. I have created an if declaration that verifies if the number is an infinite number. If this is the case, the argument is converted to a number.
This is how the total monthly payment is calculated, the full payment ,and the full interest. I used the tofixed method to translate the number into a string. I used the getElementById method to display the result and hide the loader presenting the definitive figures on the user interface.An error function has been added to the software that will notify the user if there are any invalid fields entered.
![Image Title](images/loan-calculator.jpg)