In browser, I tried to evaluate the following snippet:
window = 1; console.log(window)
The value printed in console is still the original window object instead of number 1
.
Does anyone have ideas about why window
object can't be re-assigned? Is this a feature of Javascript language? Can I make my own object not writable like window object too?