diff --git "a/07 \345\273\226\346\262\273\345\205\210/\344\275\234\344\270\232/2022-10-27\344\275\234\344\270\232.html" "b/07 \345\273\226\346\262\273\345\205\210/\344\275\234\344\270\232/2022-10-27\344\275\234\344\270\232.html" new file mode 100644 index 0000000000000000000000000000000000000000..8fb7a90fc4f64b0d6a78c8571bd0c002bf09d0e5 --- /dev/null +++ "b/07 \345\273\226\346\262\273\345\205\210/\344\275\234\344\270\232/2022-10-27\344\275\234\344\270\232.html" @@ -0,0 +1,31 @@ + + + + + + + Document + + + + + + \ No newline at end of file diff --git "a/07 \345\273\226\346\262\273\345\205\210/\347\254\224\350\256\260/2022-10-27 \347\254\224\350\256\260 \347\261\273\345\236\213\350\275\254\346\215\242.md" "b/07 \345\273\226\346\262\273\345\205\210/\347\254\224\350\256\260/2022-10-27 \347\254\224\350\256\260 \347\261\273\345\236\213\350\275\254\346\215\242.md" new file mode 100644 index 0000000000000000000000000000000000000000..4547573ea96d02962801df776bc32d8987876302 --- /dev/null +++ "b/07 \345\273\226\346\262\273\345\205\210/\347\254\224\350\256\260/2022-10-27 \347\254\224\350\256\260 \347\261\273\345\236\213\350\275\254\346\215\242.md" @@ -0,0 +1,33 @@ +``` +//新建 map +var map = new Map(); + +map.set(键1, 值); //增加数据 + +map中不能有相同的键当给相同的键增加数据是会覆盖前面的值 +delete:map.delete(键的值):根据键删除,找到该键删除成功返回(true),否则返回(false) //删除数据 + +map.set(键1,值) //更新数据 + +for (let e of ma.keys/values/entries()){ + console.log(e); + } //查找数据 + +console.log(map.has(键)); //如果map中存在对应的键返回(true)否则返回(false) + +ma.clear() //清空数据,无返回值 + +在map 中 +0,0,-0视为同一个键, +NAN(非数),NAN(非数)视为同一个键 +``` + +``` +//map转数组 [] + const arr = [...map] + const arr = [] + for(let e of map.entries()){ + arr.push(e) + } + 使用遍历for将map中的值转为数组中的值 +``` +