JSFiddle - React, Tailwind, and code Playground

by Jussia

JavaScript

function nbYear(p0, percent, aug, p) {
		var years = 0
    while (p > p0) {
       p0 = p0 + p0 * (percent / 100) + aug;
       years++
    }
    return years
}

console.log(nbYear(1500, 5, 100, 5000))