5.接口.js 342 B

123456789101112131415
  1. "use strict";
  2. (function () {
  3. class Person {
  4. constructor(name, age) {
  5. this.name = name;
  6. this.age = age;
  7. }
  8. say() {
  9. console.log('我叫' + this.name + ',今年' + this.age + '岁');
  10. }
  11. }
  12. let p = new Person("图图", 3);
  13. console.log(p, 'p');
  14. p.say();
  15. })();