Thinking about Global Variables and Global Attributes

  javascript, question

When reading javascript Advanced Programming (page194), the differences between global variables (variables declared with var in window environment) and global attributes (attributes defined directly on window objects) are introduced. Global variables are not deleted by delete attribute, and global attributes can be deleted by delete. However, global variables can be accessed through global attributes. So there is a little doubt. Both functions are similar.ECMAThe intention of this design is What?

First of all,Strongly recommendedThis post,understand delete

Next, we need to know what isGloblobject and window,execution context, andvariable object/activation objectFull stop

When passedVarOr ..FunctionWhen defining variable or function, they become the property of globlobject, and they also haveDontDeleteAttribute of. Since he is a property of globobabject, of course he can passwindow.aPropTo visit la.

And, = 1If this display defines a property for an object, the property does not haveDontDelteThe of this attribute.

As long as there isDontDelete, cannot beDeleteOperator delete.