Fork me on github
上一页 1 2 3 4 5 6 7 8 9 ··· 19 下一页
摘要: for...of es6 引入的一种遍历迭代器的循环语句 用于遍历可迭代对象的值(如数组、字符串、Set、Map、Generator 等) 每次迭代,for...of 会将可迭代对象的下一个值赋值给一个变量,然后执行循环体 for...of 不支持遍历普通对象,因为普通对象并不是可迭代的 /** * 阅读全文
posted @ 2023-07-03 19:54 zjy4fun 阅读(13) 评论(0) 推荐(0) 编辑
摘要: setTimeout(() => { console.log('setTimeout') }, 0) let promise = new Promise((resolve, reject) => { console.log('1') setTimeout(() =>{ console.log('ti 阅读全文
posted @ 2023-07-03 19:42 zjy4fun 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 1. websocket 转 promise send({type: 'getUserInfo'}) {type:'userInfo', payload: {}} const res = await getMessage({type: 'getUserInfo'},{type:'userInfo'} 阅读全文
posted @ 2023-06-28 21:40 zjy4fun 阅读(13) 评论(0) 推荐(0) 编辑
摘要: instanceof 运算符用于检测构造函数的 prototype 属性是否出现在某个实例对象的原型链上。 object instanceof constructor typeof 运算符返回一个字符串,表示操作数的类型。 typeof operand console.log(' instanceo 阅读全文
posted @ 2023-06-23 21:45 zjy4fun 阅读(5) 评论(0) 推荐(0) 编辑
摘要: hasOwnProperty 检查对象是否含有某个属性,无法检查其原型链上是否含有该属性 isPrototypeOf 检查一个对象是否存在于另一个对象的原型链上,比如parent.isPrototypeof(child)检查 parent 对象是否在 child 对象的原型链上 console.lo 阅读全文
posted @ 2023-06-23 21:23 zjy4fun 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 上面的截图中只有最后一个 border 有效果。 通常为了浏览器的兼容性,我们会选择指定多个相同相同属性。 .wrap { color: #fff; display: -webkit-box; display: -ms-flexbox; display: flex; } 上面的代码兼容了旧版的saf 阅读全文
posted @ 2023-06-22 20:14 zjy4fun 阅读(54) 评论(0) 推荐(0) 编辑
摘要: cross-env kentcdodds/cross-env: 🔀 Cross platform setting of environment scripts (github.com) 主要是解决在不同操作系统上,给程序传入环境变量的问题。 保证了跨平台兼容性和命令行的一致性,简化了配置,使环境变 阅读全文
posted @ 2023-06-22 18:45 zjy4fun 阅读(105) 评论(0) 推荐(0) 编辑
摘要: // [1, 2, 3] // [4, 5, 6] // [7, 8, 9] // [10,11,12] // // print order 1, 2, 4, 3, 5, 7, 6, 8, 10, 9, 11, 12 function test() { let arr = [ [1, 2, 3], 阅读全文
posted @ 2023-06-16 22:20 zjy4fun 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 期望的效果: 实现思路: 横向排列图片,将每个图片容器的margin-right设置为负值,让其右边元素向左移动一段距离,根据层叠关系,设置对应的 z-index,注意给每个图片设置 position,否则 z-index 不生效 margin为负值的时候,有两种情况,left 和 top为负值,以 阅读全文
posted @ 2023-06-16 19:17 zjy4fun 阅读(389) 评论(0) 推荐(0) 编辑
摘要: Promise.all Promise.all().then() 适用于处理多个异步任务,且所有的异步任务都得到结果时的情况 场景:同一个页面,数据分别是从不同的后端接口获取的 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" 阅读全文
posted @ 2023-06-15 22:01 zjy4fun 阅读(194) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 19 下一页