|
@@ -0,0 +1,26 @@
|
|
|
+/**
|
|
|
+ * 构造函数 => 函数
|
|
|
+ 普通函数
|
|
|
+ function fn1() {
|
|
|
+ }
|
|
|
+ 匿名函数
|
|
|
+ let fn2 = function() {
|
|
|
+ }
|
|
|
+ 立即执行函数
|
|
|
+ (function() {
|
|
|
+ })()
|
|
|
+ */
|
|
|
+var Person1 = /** @class */ (function () {
|
|
|
+ function Person1(name, age) {
|
|
|
+ this.name = name;
|
|
|
+ // age = b;
|
|
|
+ this.age = age;
|
|
|
+ }
|
|
|
+ Person1.prototype.hello = function () {
|
|
|
+ console.log("你好我好大家好", this);
|
|
|
+ };
|
|
|
+ return Person1;
|
|
|
+}());
|
|
|
+var p1 = new Person1("孙悟空", 20);
|
|
|
+console.log(p1, 'p1', this);
|
|
|
+p1.hello();
|