2.构造函数和this.ts 308 B

123456789101112131415161718
  1. // let xxx = function() {}
  2. // function fn1() {}
  3. // (function(){})()
  4. // function fn2(() => {})
  5. // function Fn1() {
  6. // }
  7. // new Fn1()
  8. class Person1{
  9. name2:string;
  10. age2:number;
  11. constructor(x:string,y:number) {
  12. this.name2 = x;
  13. this.age2 = y;
  14. }
  15. }
  16. let p2 = new Person1('图图',3)