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

151
Vistas
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 Respuestas
Responde la pregunta

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 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