10
0

6.接口.js 445 B

123456789101112131415161718192021
  1. (function () {
  2. // 类型定义数据
  3. let obj = {
  4. name: 'John Doe',
  5. age: 30,
  6. a: 12
  7. };
  8. // 使用接口
  9. class Person {
  10. constructor(color, types) {
  11. this.color = color;
  12. this.types = types;
  13. // this.price = price;
  14. }
  15. say() {
  16. console.log('走进来');
  17. }
  18. }
  19. let p = new Person('红色', '牡丹');
  20. console.log(p);
  21. })();