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

162
Visualizações
Need clarity regarding LET and temporal dead zone
console.log(a);

let a = 10;
var b = 100;

Output:
script.js:1 Uncaught ReferenceError: Cannot access 'a' before initialization

let a;
console.log(a);
a = 10;
console.log(a);

Output:-
undefined
10

Doubt:- While performing the first console.log(a), a is in temporal dead zone since it hasn't been initialized. So why is it not throwing any error and printing undefined?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Because you have defined the variable but not the content

in the first example the variable is defined after is called so it throw an error

in the second case the variable is defined but it's content doesn't. So the first console.log print the content undefined

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