JSFiddle - React, Tailwind, and code Playground

by Daedalus

HTML

<span id='blah'></span>

JavaScript

var cap = 1000,
    currentXP = 850,
    missionXP = 150,
    bonus = 2.5;
    remainder = 0;

if (cap < ((currentXP + missionXP) * bonus)) {
    remainder =  missionXP - ((cap - currentXP) / bonus);
    currentXP += ((missionXP - remainder) * bonus);
    currentXP += remainder;
}

document.getElementById('blah').innerHTML = currentXP;