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

267
Vistas
In the for loop, the constant variable will be declared as many time as the loop runs. Why its not an error?

for(let i =0; i<10;i++){
    const a = i;               
    console.log(a);
}

const b = 5;
const b = 10;   

for(const i =0; i<10;i++){
    const a = i;                
    console.log(a);
} 

enter code here

In above code b is declared twice so system is giving an error. Uncaught SyntaxError: Identifier 'b' has already been declared

In the for loop, the constant variable will be declared as many time as the loop runs. Why its not an error?

In the second loop why the const i throwing an error? Is const i in the for loop initialisation have a different scope?

about 4 years ago · Juan Pablo Isaza
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