1

I need to build a loan calculator. I have two sliders where the users select their loan amount, and loan period, and then it should output their monthly payment. How do I show the monthly repayment without decimals?

See my code below:

<form oninput="loanval.value=loan.value; periodval.value=period.value; paymentval.value=loan.value / period.value">

  <label>Choose Loan Amount</label>
<input type="range" id="loan" name="loan" min="5000" max="400000">              
    <output name="loanval" for="loan">0</output><br />

    <label>Choose Loan Period</label>
     <input type="range" id="period" name="period" min="12" max="72">          
    <output name="periodval" for="period">0</output><br />

     <label>Your monthly repayment will be:</label>
     <output name="paymentval">0</output>

    </form>
Shtarley
  • 313
  • 9
  • 22
  • Are you basically asking how to round a number? Did you [search](https://www.google.com/search?q=javascript+round+number)? – Felix Kling Mar 18 '16 at 13:31
  • how about `Math.round()`to round nearest integer ( or even `Math.floor()` to round down or `Math.ceil()` to round up ) – Nishanth Matha Mar 18 '16 at 13:31

0 Answers0