@@ -37,6 +37,12 @@
* for in / for of
* map/forEach
* 为什么data是函数
+ *
+ * this指向
+ * call bind apply
+ * Promise
+ * async await
+ * eventLoop
*/
let arr = [1, 2, 3, 4, 5];
let obj = {
@@ -0,0 +1,44 @@
+(function () {
+ // 泛型:用字符去指代未知类型
+ function fn1<T>(xx: T): T {
+ return xx;
+ }
+ fn1(12);
+ fn1('12');
+ fn1<boolean>(true);
+
+ function fn2<T, K>(x: T, y: K): [T, K] {
+ return [x, y];
+ fn2(12, '10')
+ interface happy {
+ weather: string
+ function fn3<T extends happy>(a: T): T {
+ return a;
+ fn3({ weather: "晴天" })
+ class Person<T extends happy> {
+ name: T
+ constructor(name: T) {
+ this.name = name;
+ let p = new Person({ weather: "晴天" })
+ // interface a {}
+})()
+/**
+ * 1.interface 和 type区别
+ * 2.联合类型 和 交叉类型
+ * 3.泛型是什么 有什么作用
+ * 4.类型断言
+ * 5.any never unknown区别
+ * 6.ts类型有什么
+ * 7.数组和元祖的区别
+ * 8.class和interface的区别
+ */
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>原型链继承</title>
+</head>
+<body>
+ <script>
+ function Father() {
+ this.name = 'Lucy';
+ this.arr = [1, 2, 3];
+ function Child() {
+ this.age = 10;
+ Child.prototype = new Father();
+ const c1 = new Child();
+ const c2 = new Child();
+ c1.age = 18;
+ c1.name = '图图'
+ c1.arr.push('00')
+ console.log(c1, 'c1')
+ console.log(c2, 'c2')
+ </script>
+</body>
+</html>
@@ -0,0 +1,38 @@
+ <title>构造函数继承</title>
+ this.fn1 = function () {
+ console.log("哈哈哈")
+ Father.prototype.say = function () {
+ console.log("你好")
+ Father.apply(this)
+ // Father.call(this)
+ console.log(c1, 'c1');
+ // c2.say()
+ c1.fn1()