// 构造函数 // function Fn1() {} // 通过new实例化:new Fn1() // 函数 // function fn1() {} // (function(){})() 立即执行函数 // 箭头函数() => xx // 匿名函数 // let xxx =function() {} // function Fn1() { // } // 构造函数:构造器(属性) 原型(方法) class Person1 { // 构造器 constructor(x, y) { console.log(this); this.name = x; this.age = y; } hello() { console.log("你好"); } } let p1 = new Person1('图图', 2); console.log(p1); p1.hello();