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

229
Views
Why does my variable become NAN when i use it in setinterval?

I wanna move my button to bottom with a couple of codes here :

var y = [];
for(var i = 0;i < 8;i++){
   y[i] = 0;
   interval[i] = setInterval(function(){
      y[i]++;
      if(parseInt(y[i]) >= window.innerHeight){
          clearInterval(this);
      }
      console.log(y[i]);
      thisbutton.style.top = y[i] + "px";
   },10);
}

My problem is that y[i] is NaN.
Can you tell me why?
thanks

about 4 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 Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!