// 构造函数 => 函数 // function Fn1() { // } // Fn1(); // new Fn1(); // 构造函数:构造器(构造函数)(属性) 原型(方法) class Person1 { constructor(name, age) { this.name = name; this.age = age; console.log(this, 'this'); } hello() { console.log("你好"); } } let p1 = new Person1('孙悟空', 20); p1.hello();