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

154
Vistas
Why does this statement does not throw an error?

We all know that JavaScript reserved keywords cannot be used as variable names. For example, var, function, let, etc are considered special keywords in JavaScript. But consider this code:

var let = "Hi";
console.log(let); // prints out "Hi"
let var = "Hi";
console.log(var); // Syntax error

I am confused as to why the browser did not throw an error when I attempted to use it as variable name, but when I tried with var, it throws an error.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

const and let are recent additions to JS, but for a long time before they were added const was a reserved keyword (presumably on the basis that it was thought to be a likely future addition to the language).

Since let used to be a valid variable name, this is presumably for backwards compatibility.

var let is ok but let let isn't?

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