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

176
Views
No se puede borrar Intervalo cuando setInterval se establece en un objeto

Tengo problemas para detener el intervalo con clearInterval cuando el valor llega a 100. Llega a 100 y luego sigue ejecutando setInterval. ¿Alguien puede decirme qué estoy haciendo mal? Agradezco su ayuda.

He proporcionado un enlace a jsfiddle. Abra console.log para ver el incremento. https://jsfiddle.net/netzsqx4/

 let values = [[]] let Circle_1 = { procent:values[0][0], startFrom:0, incrementBy:0, start: null, intervalIdAtStart: function(){this.start= setInterval(function(){drawCircle.call(Circle_1)},500)}, clear: function() { clearInterval(this.start); } } function drawCircle(inputValues){ if(this.startFrom<this.procent){ console.log('draw <', this.procent + " " + this.startFrom) this.startFrom++ } else if(this.startFrom>this.procent){ console.log('draw >', this.procent + " " + this.startFrom) this.startFrom-- } else{ console.log('else', this.procent + " " + this.startFrom) this.clear; } }; function Http(){ let output = 100 loadoutput(output) function loadoutput(input){ console.log(input) values = [ [input], ] Circle_1.procent=values[0][0] Circle_1.intervalIdAtStart() } } function getValues(){ Http(); } setTimeout(getValues,1000);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Era this.clear pero debería ser this.clear(). Esto resolvió mi problema.

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!