my aim is to make a calculator which will allow the user to input their level and how many runes(Elden Ring's in game currency) they have currently. I then want to have my code calculate how many levels the user can purchase with the amount of runes they have.
For example, let's say I am level one and I have 2,000 runes, judging by the array we have called 'runearray' the user will only be able to level up to level 3. Am I going the right way about implementing this? Here's a pic of what the user will see...
<div class="calcrune col-md-12">
<span class="runecalc">Current Level: <input id="levelcurrent1" type="text" min="1" max="712"></span>
<span class="runecalc">Current Runes: <input id="runecurrent1" type="text" min="1" max="712"></span>
<button class="runecalc" onclick="levelCalc()">Calculate Levels</button>
<span>Level Upgrades: <span id="runes1"></span></span>
</div>
function levelCalc() {
var levelcurrentstring = document.getElementById('levelcurrent1').value;
var levelcurrentminus1 = parseInt(levelcurrentstring);
var runecurrentstring = document.getElementById('runecurrent1').value;
var runecurrentvalue = parseInt(runecurrentstring);
var levelcurrent = levelcurrentminus1 - 1;
const runearray = [/* level 1 to 2 = */ 673, /* level 2 to 3 = */ 689, /* level 3 to 4 = */ 706....
];
var newrunearray = runearray[levelcurrent];
for (i = levelcurrent; i < runecurrent; i++) {
var newrunearray = newrunearray + runearray[levelcurrent + 1];
}
document.getElementById('runes1').textContent = newrunearray;
}