Skip to content

Instantly share code, notes, and snippets.

@tysonchamp
Created August 26, 2020 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tysonchamp/56b6e284329e45d48215d716b246d893 to your computer and use it in GitHub Desktop.
Save tysonchamp/56b6e284329e45d48215d716b246d893 to your computer and use it in GitHub Desktop.
loan calculator js functions
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