Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

203
Vistas
Technique to detect where Javascript gets stuck?

I'm debugging unobfuscated Javascript code. At some point, the code gets stuck in some never-returning function or infinite loop. What's the fastest way to find this part of the code? I assume there's a better way than adding a bunch of breakpoins/prints.

I'm using Chrome Developer Tools.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

If you open devtools and wait for the code to get to the infinite loop, you can click the pause button in devtools, which will pause the code somewhere within the loop.

enter image description here

For instance, I wrote a page with this code:

setTimeout(() => {
    let n = 0;
    while (isFinite(n)) {
        n = n + 1;
    }
}, 800);

and ran it, opened devtools, and clicked the Pause button. It paused the code in the while:

enter image description here

about 4 years ago · Juan Pablo Isaza Denunciar

0

If you are really on a loop with the console opened, go to "Sources" tab, then click on the "Pause" icon. The code will pause and you will see where it is stuck :)

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda