| 12345678910111213141516171819 |
- // function Person() {
- // }
- (function () {
- class Person {
- name: string;
- age: number;
- constructor(name: string, age: number) {
- console.log(this, 'this1')
- this.name = name;
- this.age = age;
- console.log(this, 'this2')
- }
- }
- let p1 = new Person("孙悟空", 30);
- let p2 = new Person("猪八戒", 40);
- })()
|