| 1234567891011121314151617 |
- "use strict";
- // 构造函数
- // function fn1() {
- // };
- // fn1();
- // new fn1();
- class Person1 {
- constructor(name, age) {
- this.name = name;
- this.age = age;
- }
- hello() {
- console.log("hi");
- }
- }
- let p2 = new Person1('八戒', 10);
- p2.hello();
|