dps123
dps123

Reputation: 1073

vb script to javascript

Can anyone help me to convert this VB script to equivalent Javascript please.

PMT = ((PV - FV) * rate/ (1 - (1 + rate) ^ -(nper)))

Upvotes: 1

Views: 253

Answers (1)

Pointy
Pointy

Reputation: 414006

Probably

var PMT = ((PV - FV) * rate / (1 - Math.pow(1 + rate, -nper)));

JavaScript numbers are always (at heart) floating-point values, so when you're dealing with money things can get somewhat weird.

Upvotes: 6

Related Questions