more ways to declare a name in javascript:
- using x = resource
- class x {}
-
- for (x of [1]) {} // assigns x = 1 outside loop scope
- for (x in {1:null}) {} // same but with the key "1"
- globalThis.x = 1
- window.x = 1
- self.x = 1
- top.x = 1
- this.x = 1 // at top level these all target window
- Object.defineProperty(globalThis, "x", {value:1})
- [x] = [1]
- ({x} = {x: 1})
- import { x } from "..."
- function x() {}
- function* x() {}
- async function x() {}
- async function* x() {}
- eval("...") // using any of the above
- new Function("...")() // same