From cbbc6c19ab8dc30728ffe2022af075f14a123b25 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=A9=AC=E9=91=AB=E6=B6=9B?= <1722781630@qq.com>
Date: Wed, 2 Nov 2022 21:05:35 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E7=AC=AC=E5=85=AB=E6=AC=A1=E4=BD=9C?=
=?UTF-8?q?=E4=B8=9A=E5=92=8C=E7=AC=94=E8=AE=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../7.html" | 24 ++++
.../map&set.md" | 118 ++++++++++++++++++
2 files changed, 142 insertions(+)
create mode 100644 "45\351\251\254\351\221\253\346\266\233/\344\275\234\344\270\232/2022-10-27map&set\344\275\234\344\270\232/7.html"
create mode 100644 "45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-10-27map&set\347\254\224\350\256\260/map&set.md"
diff --git "a/45\351\251\254\351\221\253\346\266\233/\344\275\234\344\270\232/2022-10-27map&set\344\275\234\344\270\232/7.html" "b/45\351\251\254\351\221\253\346\266\233/\344\275\234\344\270\232/2022-10-27map&set\344\275\234\344\270\232/7.html"
new file mode 100644
index 0000000..913a580
--- /dev/null
+++ "b/45\351\251\254\351\221\253\346\266\233/\344\275\234\344\270\232/2022-10-27map&set\344\275\234\344\270\232/7.html"
@@ -0,0 +1,24 @@
+
+
+
+
+
+ Document
+
+
+
+
+
\ No newline at end of file
diff --git "a/45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-10-27map&set\347\254\224\350\256\260/map&set.md" "b/45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-10-27map&set\347\254\224\350\256\260/map&set.md"
new file mode 100644
index 0000000..778bee9
--- /dev/null
+++ "b/45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-10-27map&set\347\254\224\350\256\260/map&set.md"
@@ -0,0 +1,118 @@
+### map&set
+
+###### map
+
+1.Map:键值对,类似于对象
+
+ 键是唯一的
+
+1.
+
+/创建map对象 //var map = new Map();
+
+```
+ //添加
+ //map.set(1,'呼呼');
+ //map.set(2,"拉拉");
+ //console.log(map);
+
+ //查看 v
+ //console.log(map.get(1));
+
+ //删除
+ //map.delete(1);
+ //console.log(map);
+
+ //返回map存在的键的数组
+ //console.log(map.keys());
+
+ //返回map存在的值的数组
+ //console.log(map.values());
+
+ //返回map中存在的键值对的数组
+ //console.log(map.entries());
+
+ //查看键是否存在
+ //console.log(map.has(1));
+
+ //查看map的长度
+ //console.log(map.size);
+```
+
+特殊情况:
+
+```
+// console.log(+0===-0); //true
+// console.log(Object.is(+0,-0)); //false
+// console.log(Object.is(+0,0));
+
+
+// let map = new Map();
+
+// map.set(-0, 123); //不管是+0,0,-0,当成了同一个键,
+// map.get(+0);
+```
+
+//map转数组 []
+
+```
+//const arr = [...map]
+// const arr = []
+// for(let e of map.entries()){
+// arr.push(e)
+// }
+
+
+
+
+
+//数组转map
+// const arr = [['name', 'zoe'], ['age', 18]]
+// var map = new Map([
+// ['name', 'zoe'], ['age', 18]
+// ])
+```
+
+###### set
+
+对象类似于数组,且成员的值都是唯一的
+
+去重
+
+```
+ // const arr = [1,3,3,5,7,9];
+ // const arr2 = [...new Set(arr)];
+ // console.log(arr2);
+ //Map 和 Set 都不允许键重复
+ //Set 不能通过迭代器来改变Set的值,因为Set的值就是键
+```
+
+set 转数组
+
+```
+const arr = [...set]
+```
+
+数组转set:数组去重
+
+```
+const arrs = [1,3,54,5,6,5,5,5,5,5,5,5]
+ console.log(arrs.length);
+
+ var sets = new Set(arrs);
+```
+
+3.WeakSet
+
+WeakMap:弱引用(直接回收),强引用(不会强制回收)
+
+```
+// var weakset = new WeakSet()
+
+ // var name = 'Joe'
+ // var map = new Map();
+ // map.set(name,'Zoe')
+
+ // var weakmap = new WeakMap();
+ // weakmap.set(name,'Zoe')
+```
\ No newline at end of file
--
Gitee
From da49de059e391102f0118feb8c96135396831646 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=A9=AC=E9=91=AB=E6=B6=9B?= <1722781630@qq.com>
Date: Wed, 2 Nov 2022 21:06:58 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E7=AC=AC=E4=B9=9D=E6=AC=A1=E7=AC=94?=
=?UTF-8?q?=E8=AE=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\351\242\204\347\274\226\350\257\221.md" | 57 +++++++++++++++++++
1 file changed, 57 insertions(+)
create mode 100644 "45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-10-28\351\242\204\347\274\226\350\257\221\347\254\224\350\256\260/\351\242\204\347\274\226\350\257\221.md"
diff --git "a/45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-10-28\351\242\204\347\274\226\350\257\221\347\254\224\350\256\260/\351\242\204\347\274\226\350\257\221.md" "b/45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-10-28\351\242\204\347\274\226\350\257\221\347\254\224\350\256\260/\351\242\204\347\274\226\350\257\221.md"
new file mode 100644
index 0000000..2ac47c0
--- /dev/null
+++ "b/45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-10-28\351\242\204\347\274\226\350\257\221\347\254\224\350\256\260/\351\242\204\347\274\226\350\257\221.md"
@@ -0,0 +1,57 @@
+# 预编译
+
+### 作用域
+
+ var:如果在全局,块级 --> 全局变量 局部作用域(function)-->局部变量
+
+ let:不管在哪,都是局部
+
+ 没有任何声明 a=5,不管在哪,都是全局
+
+**JS(单线程):**
+
+ **扫描全局:看有没有语法错误**
+
+ **预编译(变量提升):**
+
+ **1.创建一个AO(activation object)对象:临时存储容器**
+
+ **2.往AO装形参,值赋为undefined AO={a:undefined, b:undefined}**
+
+ **2.1找变量声明,值也赋为undefined AO={a:undefined, b:undefined,c:undefined}**
+
+ **3.将形参与实参的值统一 AO=AO={a:1, b:2,c:undefined}**
+
+ **4.找函数声明,值赋予函数体AO={a:f a(){}, b:2,c:f c(){}}**
+
+ **执行一句,解释一句**
+
+例子: function fn(a,b) {
+
+ console.log(a);
+
+ function a(){}
+
+ var a = 5;
+
+ console.log(a);
+
+ console.log(c);
+
+ var c = 3;
+
+ function c(){}
+
+ console.log(c);
+
+ }
+
+ fn(1,2)
+
+### GO AO
+
+GO:文件执行之前
+
+AO:执行函数的前一刻
+
+GO比AO先执行
\ No newline at end of file
--
Gitee
From 1176a297148527b25e39914950720144e61612a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=A9=AC=E9=91=AB=E6=B6=9B?= <1722781630@qq.com>
Date: Wed, 2 Nov 2022 21:07:45 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E7=AC=AC=E5=8D=81=E6=AC=A1=E7=AC=94?=
=?UTF-8?q?=E8=AE=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../\351\227\255\345\214\205.md" | 42 +++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 "45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-10-31\351\227\255\345\214\205\347\254\224\350\256\260/\351\227\255\345\214\205.md"
diff --git "a/45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-10-31\351\227\255\345\214\205\347\254\224\350\256\260/\351\227\255\345\214\205.md" "b/45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-10-31\351\227\255\345\214\205\347\254\224\350\256\260/\351\227\255\345\214\205.md"
new file mode 100644
index 0000000..15a2a08
--- /dev/null
+++ "b/45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-10-31\351\227\255\345\214\205\347\254\224\350\256\260/\351\227\255\345\214\205.md"
@@ -0,0 +1,42 @@
+### 闭包
+
+###### 基本格式:
+
+```
+function a(){
+
+ var aa = '这是外层函数';
+
+function b(){
+
+ var bb = '这是中层函数';
+
+ function c(){
+
+ var cc = '这是里层函数,我最先释放';
+
+ }
+
+ return c; //返回值
+
+ }
+
+ b();
+}
+//a();
+var fun = a();
+```
+
+作用域,作用域链
+
+最里面的先自动销毁
+
+###### 闭包作用
+
+-实现公有变量
+
+\- 可以做缓存(存储结构)
+
+\- 可以实现封装(继承)
+
+\- 模块化开发,防止污染全局变量
\ No newline at end of file
--
Gitee