6.接口.js 491 B

12345678910111213141516171819202122
  1. "use strict";
  2. (function () {
  3. // 类去继承接口
  4. class Person {
  5. constructor(name1, name2, name3) {
  6. this.name1 = name1;
  7. this.name2 = name2;
  8. this.name3 = name3;
  9. }
  10. say() {
  11. console.log(this.name1, this.name2, this.name3);
  12. }
  13. }
  14. let p = new Person('水仙', "1", "1");
  15. console.log(p);
  16. p.say();
  17. const aa = {
  18. color: 'red',
  19. flower: '牡丹'
  20. };
  21. console.log(aa);
  22. })();