Mortgage Payment Calculator
Make a web app that has input fields for a mortgage loan amount, interest rate, and number of payments, and uses those values to calculate the monthly loan payment. Have a "Calculate" button, which will show the answer on the page when clicked.
Use the following formula:
P * r (1 + r)^n P = Principal Loan amount ($)
------------------- r = Monthly Interest Rate (decimal)
(1 + r)^n - 1 n = Number of Payments (months)
- Have it display the answer with no more than 2 decimals
- Be sure to convert the values to floats after you extract them from page input fields
Hint: Code for displaying a number to 2 decimals
Specify precision within the parenthesis of the toFixed() function
var answer = ...
console.log(answer.toFixed(2))
Hint: Code for extracting values and converting them to floats
var value = parseFloat( document.getElementById("myInput").value );