"use strict"; (function () { // 类型别名 定义数据 const obj = { name: "孙悟空", age: 20, }; // 继承 extends // 接口 interface implements class Person { constructor(name, age, sex, num) { this.name = name; this.age = age; this.num = num; this.sex = sex; } say() { console.log(this.name, this.age, this.num, this.sex, '我是个好人'); } } let a = new Person("猪八戒", 20, "男", 1); a.say(); })();