Comprehensive Rent Affordability
function rentCalc() {
var inc = parseFloat(document.getElementById(‘rent-income’).value) || 0;
var exp = parseFloat(document.getElementById(‘rent-exp’).value) || 0;
var sv = parseFloat(document.getElementById(‘rent-save’).value) / 100 || 0.2;
if (!inc) return;
var maxRent = inc – (inc * sv) – exp;
var fmt = new Intl.NumberFormat(‘en-US’, {style:’currency’,currency:’USD’,maximumFractionDigits:0});
document.getElementById(‘rent-max’).textContent = fmt.format(Math.max(0, maxRent));
document.getElementById(‘rent-result’).style.display = ‘block’;
}