Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let interestAmount = Money('$0.00');
- - if (loanAmount.greaterThan(ranges[0].endOfRange)) {
- - interestAmount = interestAmount.plus(calculateInterest(loanAmount, ranges[0]));
- - }
- -
- - if (loanAmount.greaterThan(ranges[1].endOfRange)) {
- - interestAmount = interestAmount.plus(calculateInterest(loanAmount, ranges[1]));
- - }
- -
- - if (loanAmount.greaterThan(ranges[2].endOfRange)) {
- - interestAmount = interestAmount.plus(calculateInterest(loanAmount, ranges[2]));
- + for (let i = 0; i < ranges.length; i += 1) {
- + if (loanAmount.greaterThan(ranges[i].endOfRange)) {
- + interestAmount = interestAmount.plus(calculateInterest(loanAmount, ranges[i]));
- + }
- }
- return interestAmount;
Add Comment
Please, Sign In to add comment