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

159
Vistas
Why doesn't microtask have timeout?
async function() {
  while (true) {
    await null;
  }
}

This will block the thread forever, because the event loop would try to finish all microtasks in one frame.

But if the event loop suspends processing next microtask after 1 second, the thread can be used to process other code, for example, animation frame.

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

0

Could it be possible for a JavaScript engine to detect potentially bad code?

Yes!

Is this useful?

Certainly could be. After all, TypeScript's and (to some extent) ESLint's job is to find problematic code and warn you.

Does the engine warn against potentially code?

Sometimes! For instance, most engines will warn you when rejected Promises remain uncaught.

Why don't they for this case?

I can't speak for JavaScript engine manufacturers, but I can potentially imagine that if they would implement a warning / some behavior against your pet issue is going to be based on a number of factors, including how likely it is that this is a problem, how easy it is to detect and what's the cost in the engine to try and figure out if something bad is happening. Nothing is free and JavaScript engines need to be fast.

In my opinion this is an unlikely mistake for someone to make, and if the mistake is made it's quickly noticed because of how bad the effects are. This doesn't feel like the case where handholding is needed.

But even if this is a common problem, I feel ESLint is probably still a better place for something to detect and warn you.

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