I expect set window variable before its inner class defined, so I make following code
Object.assign(window, {
get C2() {
return C
}
})
class C {
}
new C2()
but it raise Uncaught ReferenceError: Cannot access 'C' before initialization, I know put class C def before Object.assign can fix this err, but my confused is why following code cannot later get
Object.assign(window, {
get C2() {
return C
}
})