title: how to calculate mortgage in javascript
body: <p>I have formula for finding monthly payment with four fields</p>
  
  <ol>
  <li>Loan Amount</li>
  <li>Interest Rate</li>
  <li>Terms of loan</li>
  <li>Monthly Payment</li>
  </ol>
  
  <p><code>Formula: Monthly Payment =Loan amount * ((1 + Interest rate per annum/100) ^ Term of loan) / Term of loan / 12</code></p>
  
  <p>Now I want to find</p>
  
  <ol>
  <li>Loan Amount</li>
  <li>Interest Rate</li>
  <li>Terms of loan</li>
  </ol>
  
  <p>if any of three fields are populated.</p>
  
  <p>I have also formula for calculating loan amount based on interest rate, terms of loan and monthly payment.</p>
  
  <pre><code>Formula: Loan amount = Monthly Payment/ ((1 + Interest rate per annum/100) ^ Term of loan) * Term of loan * 12
  </code></pre>
  
  <p>But it does not calculating perfect figure.</p>
  
  <p>Any one can give me these three formulas for calculating loan amount/interest rate/terms of loan (java script will be more appreciated)</p>