摘要:
for (var index = 1; index < 5; index++) { ((i) => { setTimeout(() => { // console.log(i); }, 1000 * i); })(index) } for (let index = 1; index < 5; ind 阅读全文
摘要:
// 红黄绿: 使用异步编程方案, promise, async await等都行 // 循环打印: 一轮打印完了以后递归重复这一过程 const taskRunner = (light, timeout) => { return new Promise((resolve) => { setTime 阅读全文
摘要:
先找到根(父)节点,然后根据根节点的id和数组元素的pid找到对应父子关系 重复上一步骤 const getTree = (root, list) => { if(!Array.isArray(list)) throw 'list must be Array' root = root || list 阅读全文