<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>
    //this
//    一、this只出现在函数中。
//    二、谁调用函数,this就指的是谁。
//    三、new People();   People中的this代指被创建的对象实例。


//    var aaa = new Object();
    //new
//1.开辟内存空间,存储新创建的对象( new Object() )
//2.把this设置为当前对象
//3.执行内部代码,设置对象属性和方法
//4.返回新创建的对象

    var aaa = new stu();
    console.log(aaa);
    aaa.say();

    function stu(){
        this.say = function () {
            console.log(this);
        }
    }


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

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-27
  • 2021-06-04
  • 2022-02-15
  • 2021-09-07
  • 2021-11-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
相关资源
相似解决方案