Created
August 26, 2020 06:36
-
-
Save tysonchamp/56b6e284329e45d48215d716b246d893 to your computer and use it in GitHub Desktop.
loan calculator js functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cal_eligibility() { | |
var e = 1e5, | |
r = document.getElementById("months_display").value / 12, | |
a = document.getElementById("interest_display").value / 100, | |
t = document.getElementById("income_display").value; | |
repay_max = 50, repay_min = 35; | |
var s = t * repay_max / 100, | |
n = t * repay_min / 100, | |
i = Math.pow(1 + a / 12, 12 * r), | |
o = parseFloat(e) / ((1 - 1 / i) / (a / 12)), | |
l = Math.round(s / o), | |
u = Math.round(n / o), | |
d = " Lacs", | |
c = " Lacs"; | |
l >= 100 && (d = " Cr", l /= 100, l = Math.round(100 * l) / 100), u >= 100 && (c = " Cr", u /= 100, u = Math.round(100 * u) / 100), document.getElementById("result_eligible").innerHTML = " " + u + c + " - " + l + d | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment