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

203
Vistas
In top Level of a script, is LexicalEnvironment the same as VariableEnvironment

I have browsed many similar questions and ECMA262 2022 for some days, but still don't know why.

  1. I know LE is the same as VE originally, does it means that they point to one Environment Record.
  2. in the top level of the script, if contains let or const declarations, will a new Environment Record be created and LE point to it?

Am I right to think it as following?

let a = 1
var b = 2
console.log(a)
---------------------------
// Pseudo code:
// which right? or other else

global Execution Context = {
  VE: {
    bindings: b
    [[outerEnv]]: null
  },
// create a new ER whose [[outerEnv]] is null. then LE point to it.
  LE: {
    bindings: a
    [[outerEnv]]: null
  }
}

or

global Execution Context = {
  VE: {
    bindings: b
    [[outerEnv]]: null
  },
// create a new ER whose [[outerEnv]] is the original ER (which the unchangeable VE point to)
// then LE point to it
  LE: {
    bindings: a
    [[outerEnv]]: VE
  }
}
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