摘要: 深度优先:从树节点的最左边第一个子节点开始遍历,如果当前节点还有子节点则继续往下遍历,无子节点则往右跳到下一个兄弟节点遍历: function dfs(node, nodeList = []) { nodeList.push(node); children = node.children; for( 阅读全文
posted @ 2021-03-01 15:49 lsboom 阅读(309) 评论(0) 推荐(0) 编辑
摘要: 防抖:一段时间内触发很多次的事件,限制到只执行一次,即只有最后一次触发事件生效,如页面滚动事件,代码: function debounce(func, wait) { let timer = null; //闭包 return () => { if (timer) { clearTimeout(ti 阅读全文
posted @ 2021-03-01 11:14 lsboom 阅读(80) 评论(0) 推荐(0) 编辑