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

188
Visualizações
Why can let declare variables repeatedly?

Why can let declare variables repeatedly in the browser console?

I remember that I would have reported an error before. Is 21-year chrome based on that ECMA-specification?

let a=1
undefined

let a=12
undefined

navigator.userAgent
'Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chro
me/93.0.4577.82 Safari/537.36'

Here's a screenshot:

enter image description here

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

0

The console environment has a number of odd quirks. It's not like a standard <script> tag on the page.

One of the quirks is these. The way it used to be in Chrome was, re-declarations of variables with let was not permitted - you'd get the expected error that the re-declaration is invalid syntax. But as of Chrome 80 or so (spring 2020), it was changed to be permitted.

You still can't re-declare variables with let in a standard <script>, of course:

let foo = 5;
let foo = 10;

about 4 years ago · Juan Pablo Isaza Relatório

0

You cannot redeclare a variable previously declared with let in strict mode. Please see: What's the difference between using "let" and "var"?.

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