九门宁生

导航

window对象

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <script>
    // 当我们是用window的成员的时候,window可以省略
    // window.document
    // window.alert('hello');
    

    // 定义的全局变量都属于window ,都是window对象的属性
    // var age = 18;
    // console.log(window.age);
    // 
    // console.dir(window);
    // 
    // name 是window的属性,是字符串类型
    var name = 123;
    console.log(name);

    window.console.log('hello');
    // top 是window的属性,只能获取不能赋值
    var top = 'top';
    console.log(top);

    var age = 18;
    console.log(age);


  </script>
</body>
</html>

 

posted on 2019-08-27 13:23  九门宁生  阅读(99)  评论(0编辑  收藏  举报