Created
January 28, 2023 13:48
-
-
Save TejasQ/f40fc0ca03b2be5a8b39946d3a255e71 to your computer and use it in GitHub Desktop.
etf calculator
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
let appreciation=.0238; | |
let initial=80000; | |
let lastMultiplier = 1; | |
for (i=0; i<50; i++) { | |
const a = initial; | |
const currentMultiplier = Math.floor(initial/80000); | |
initial = Math.round(initial + (initial * appreciation)); | |
if (lastMultiplier < currentMultiplier) { | |
lastMultiplier = currentMultiplier; | |
console.log(`${i} years until ${currentMultiplier}x.`); | |
} | |
//console.log(`Year ${i+1}: Start at ${a}, end at ${initial}. Gain is ${Math.round(initial-a)}. Difference to beginning = ${initial/80000}x.`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment