I coded the following quick loan calculator using online tutorials and stuff as I have very basic coding skills. It works perfectly, the only thing that I need changed is that all three the output amounts needs spaces in the numbers... for example, it should output "400 000" instead of "400000". How can I add a space or a coma to make the large numbers more readable?
<form oninput="loanval.value=loan.value; periodval.value=period.value; paymentval.value=Math.floor(loan.value / period.value)">
<label>Loan Amount</label>
<input type="range" id="loan" name="loan" min="5000" max="400000" step="5000">
<output name="loanval" for="loan">0</output>
<label>Loan Period</label>
<input type="range" id="period" name="period" min="1" max="15">
<output name="periodval" for="period">0</output>
<label>Your monthly repayment will be:
<output name="paymentval">0</output>
</form>