// 普通函数 // function Person() { // console.log('aa'); // } // // 构造函数 // function Person() { // constructor() { // } // } // Person.prototype => 对象的原型 // new Person(); //类 class Person1 { constructor(name, age) { this.name = name; this.age = age; // 当前对象 console.log(this, 'this'); } // 类方法 hello() { console.log("你好", this); } } let p1 = new Person1("哪吒", 3); p1.hello();