Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

154
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda