Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
JavaScript - Initial value to Target value within a set time

I have an integer value that I want to take from the initial value of 0 to 100 over the span of 10 seconds; However, I don't want it to start from 0 and go instantly to 100 within that time-span, I want it to climb up to that value overtime, so from 0 to 1 to 2, etc. How could this effect be achieved?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use setInterval and update the value:

    let value = 0;
    
    let interval = setInterval(function () {
      if(value >= 10) {
        clearInterval(interval);
        return 
      }        

      value++;
      
      document.getElementById("value").innerHTML = value;
    }, 1000);
<div id="value">0</div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!