I am trying to put this JavaScript in Adobe as a calculation field. The point of this is to use Term, Amount Financed and APR (Interest Rate) to calculate a monthly car payment for a form I'm creating. All I want to know is what JavaScript code will work? PS. I have limited knowledge in JavaScript.
This code calculates $208.80 a month when the correct calculation in fact is $100 More...
APR Is .21, Term is 60, Amount to Finance is 10,000.00.
My current code below:
var R = Number(this.getField("APR").valueAsString);
var N = Number(this.getField("Term").valueAsString);
var P = Number(this.getField("AmountFinanced").valueAsString);
event.value = P * (R / 12), Math.pow(N, (1 + R)) / Math.pow(N, (1 + (R / 12) - 1));
Looks like you're trying to implement this:
That would look something like
P * (R/12) * (Math.pow((1 + (R/12)), N))/ ((Math.pow((1 + (R/12)), N)) - 1)