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

148
Visualizações
Why can I define something as 'let'?

I was experimenting with JS and jokingly tried to redefine let keyword and surprisingly it worked.

It does not work with any other keywords like while,const,var etc. Any reason why JS is working fine with this?

let = 'Weird'
console.log(let)
console.log(typeof let)
console.log(let.length)

let = ['Weird','Very Weird']
console.log(let)
console.log(typeof let)
console.log(let.length)

let = 80
console.log(let)
console.log(typeof let)
console.log(let/80)

Also another weird thing:

var let = 'Even More Weird'
console.log(let)
let = 50
console.log(let)
let = (x)=>x**2
console.log(let(3))

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

0

you can redeclare let if you don't specify strict mode by :

"use strict"; // firt statement on the script
...

it depends also in the engine that execute the code, in firefox(spiderMonkey engine) engine you would see an error : "Uncaught SyntaxError: redeclaration of let i", but in V8 in chrome if you don't specify a strict mode, it would work without problem

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