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

125
Views
Cómo restablecer el intervalo de la función de intervalo establecido

Me pregunto cómo detener esta función cuando next no es igual a targetVar y aquí está mi código:

 function detectChange(next,targetVar){ if (next==targetVar){ waktuSholat(); console.log("Waktu Sholat Berhasil Di Perbarui"); } else if (next!=targetVar){ speakIt(); } } setInterval(detectChange, 2000);

No sé cómo detener este intervalo. Agradezco mucho tu ayuda y tu sugerencia.

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

0

Almacene la identificación devuelta por setInterval y llame a clearInterval para detenerla. Tenga en cuenta que detectChange se llama cada vez sin ningún argumento, por lo que tanto next como targetVar siempre están undefined ; quizás quisiste verificar las variables globales en su lugar.

 function detectChange(next,targetVar){ if (next==targetVar){ waktuSholat(); console.log("Waktu Sholat Berhasil Di Perbarui"); } else { speakIt(); clearInterval(id); } } let id = setInterval(detectChange, 2000);
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!