Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!