function backToThePast (input) { let ownMoney = Number(input[0]); let yearToLive = Number(input[1]); let age = 18; for (let year = 1800; year <= yearToLive; year++) { if (year % 2 === 0) { ownMoney -= 12000; age++; } else { ownMoney -= (12000 + 50 * age) age++; } } if (ownMoney >= 0) { console.log(`Yes! He will live a carefree life and will have ${ownMoney.toFixed(2)} dollars left.`) } else { console.log(`He will need ${Math.abs(ownMoney).toFixed(2)} dollars to survive.`) } }