• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

141
Views
How do I make a money to levels calculator in Javascript?

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...

User's POV

        <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;
}
almost 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error