How can the equation be translated into JavaScript?
This is the proposed programming solution, but there seems to be an issue.
var MIR = parseFloat(($('#aprrate').val() / 100) / 12);
var paymentAmount = (MIR * $('#amounttofinance').val())/(1 - Math.pow((1 + MIR), -$('#numberofpayments').val()));
$('#paymentamount').val(paymentAmount);
UPDATE: The payment amount textbox displays NaN.
An alternative attempt:
var MIR = parseFloat((parseFloat($('#aprrate').val()) / 100) / 12);
var paymentAmount = (MIR * parseFloat($('#amounttofinance').val()))/(1 - Math.pow((1 + MIR), -parseInt($('#numberofpayments'),10).val()));
$('#paymentamount').val(paymentAmount);
However, this second code snippet results in a blank output.