"use strict"; // 构造函数 => 函数 // function fn1() { // console.log(this) // } // fn1(); // new fn1(); class Person1 { constructor(name, age) { console.log(this, 'this1'); this.name = name; this.age = age; console.log(this, 'this2'); } play() { console.log("我叫" + this.name); } } let p1 = new Person1('哪吒', 3); let p2 = new Person1('唐僧', 30); console.log(p1, 'p1'); console.log(p2, 'p2'); p1.play(); p2.play();