I believe you are not unfamiliar with the global variables, in the function scope of the form defined by A=1 is a global variable, in the global scope, in the following 3 forms can be created to the globally visible name:
1 <script>2var a = 1; 3 b = 2; 4 window.c = 3; 5 </script>
For b=2 this way, it is actually the same as C, in the execution of this assignment, we will find the variable named B along the scope chain, always find the top of the scope chain has not been found, and then add a property B to the window and then assign a value.
There are two differences between Var and no Var:
A global variable of 1 var cannot be deleted because delete intelligently deletes the deleted property of the object, while the global attribute defined by VAR is marked as non-removable. It should be stated that the delete is unsuccessful and does not throw a wrong, and the return value of delete is True|false.
The global variables defined by the 2 Var are promoted, without the global variables defined by VAR being promoted. You can see the results of the following programs:
<script>alert (a); var a=1; </script>
<script>alert (a); // error, a undefineda=1; </script>