5.接口.js 473 B

123456789101112131415161718
  1. "use strict";
  2. (function () {
  3. // 类型别名 接口区别
  4. // 接口:定义数据类型的规范
  5. // 类实现接口 需要继承
  6. // 类型约束
  7. class List {
  8. constructor(name, age, address, sex, x) {
  9. this.name = name;
  10. this.age = age;
  11. this.address = address;
  12. this.sex = sex;
  13. this.x = x;
  14. }
  15. }
  16. let x = new List('图图', 3, '上海', '男', '12');
  17. console.log(x);
  18. })();