What is the default behavior of this at the top level in ES6 Modules, as opposed to CommonJS modules?

  • Lexical scoping
  • Dynamic scoping
  • No scoping
  • Global scoping
In ES6 Modules, the this keyword behaves according to lexical scoping, meaning it retains the value of this from the surrounding scope. This is different from CommonJS modules, where this refers to the exports object.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *