js题51-100

2022/3/15

# 51.id选择器问题

# 52.Worker作用

# 53.正则2

# 54.super对象

# 55.Symbol问题

# 56.首屏渲染时间

# 57.addEventListener移除

# 58.红绿灯

# 59.+优先级

# 60.节流事件

# 61.instanceof

# 62.this2

# 63.数组转对象

# 64.收集所有的DOM元素

# 65.多维数组全排列

# 66.交并集

# 67.手写继承

# 68.localStorate

# 69.手写JSONP实现

# 70.无符号计算

# 71.简易JSX compiler

# 72.链式函数

# 73.自定义事件















 
 
 
 
 
 
 
 
 
 



<body>
    <button id="add"> +1 </button>

    <script>
        const addBtn = document.querySelector("#add");
        addBtn.addEventListener("click", () => {
            let num = localStorage.getItem("num")
            if (!num) {
                num = 0;
            }
            num = +num + 1;
            localStorage.setItem("num", num);
        });

        /* 通过自定义事件让 localStorage 变成响应式 */
        (() => {
            const oritinItem = localStorage.setItem;
            window.localStorage.setItem = (key, val) => {
                const setItemEvent = new CustomEvent("setLocalStorage", { detail: { key, val } });
                dispatchEvent(setItemEvent);
                oritinItem.call(window.localStorage, key, val)
            }
        })()
        window.addEventListener("setLocalStorage", e => alert(JSON.stringify(e.detail)));
    </script>
</body>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

# 74.命名小驼峰转下划线

# 74.命名下划线转小驼峰

# 75.数组转树

# 76.限制请求数量

# 77.中文读法转换

# 78.去除字符串最少重复字符

# 79.归属数组

# 80.全排列

# 81.单数组全排列

# 82.深拷贝

# 83.this指向

# 84.树每层节点和

# 85. 有序数组原地去重

# 86.叠词数量

# 87.sleep函数

# 88.强密码正则

# 89.辗转相除法(gcd)

# 90.缓存函数

# 91.斐波那契

# 92.LazyMan

上次更新: 11/1/2024