var name has been the global variable type string typeof

In the big picture
window.name=" ";

 

 

 

the global name property special, whether any var name = value, which are equal to the final string

console.log (the window.name)                   // "" 
console.log ( typeof name);                  // "String"; name became the window.name 
console.log ( typeof Age);                   // undefined 
console.log ( typeof window .name);           // "string" 
// var equal to any value in the global name, the string will become the final, "value" 
var name = to true   // because it is the global name: name of the final value becomes " to true " 
Console.log(typeof name) // string

(function(){
      var name=true  //At this time, the function name is a local variable, so that the string does not become 
      the console.log ( typeof name) // Boolean 
}) ()

 

Guess you like

Origin www.cnblogs.com/javascript9527/p/11365544.html