会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
返回博主主页
懒惰的星期六
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
12
13
14
15
16
17
18
19
20
···
29
下一页
2021年11月24日
js运算符!
摘要: 1.注意字符串“1”、“0”,数字1、0,空字符串,undefined和null。 var arr = [undefined, null ,1, "1", 0, "0", ""]; arr.forEach((a)=>{ console.log(a,!a,!!a,!!!a); })
阅读全文
posted @ 2021-11-24 14:39 懒惰的星期六
阅读(70)
评论(0)
推荐(0)
2021年11月20日
React的生命周期
摘要: React的生命周期 1. 挂载卸载过程 1.1.constructor() 1.2.componentWillMount() 1.3.componentDidMount() 1.4.componentWillUnmount () 2. 更新过程 2.1. componentWillReceiveP
阅读全文
posted @ 2021-11-20 14:06 懒惰的星期六
阅读(44)
评论(0)
推荐(0)
2021年11月17日
async/wait 多个async函数嵌套
摘要: 1. 假如函数 async function A(){ await customFun(); console.log("A"); } A()会等到customFun()的函数体内所有的代码执行结束,再执行console.log("A")。 async function customFun() { c
阅读全文
posted @ 2021-11-17 22:13 懒惰的星期六
阅读(4201)
评论(0)
推荐(0)
js中A函数调用B函数,使用async/await的区别
摘要: 背景,需要发起一个网络请求(setTimeout模拟),3秒得到结果。 要求必须在这个网路请求之后才能访问请求到的数据myRes。 要求调用方f4() 和 发起网络请求的f3()都必须用async/await。 假如f4()不用async/await,f3()用。代码执行到promise内部,执行完
阅读全文
posted @ 2021-11-17 16:43 懒惰的星期六
阅读(377)
评论(0)
推荐(0)
Promise的宏任务与微任务
摘要: 先看例子: new Promise(function(resolve, reject) { console.log(1); setTimeout(function() { console.log("First"); resolve(); }, 1000); console.log(2); } ).t
阅读全文
posted @ 2021-11-17 11:46 懒惰的星期六
阅读(752)
评论(0)
推荐(0)
js执行引擎
摘要: 1. 深入理解 JS 引擎执行机制(同步执行、异步执行以及同步中的异步执行) 2. async function_实例说明async/await的执行顺序 3. setTimeout和setInterval 4. 微任务宏任务嵌套执行 5. async/await以及js中的微任务和宏任务
阅读全文
posted @ 2021-11-17 10:03 懒惰的星期六
阅读(79)
评论(0)
推荐(0)
2021年11月11日
JavaScript函数参数翻转——连接多个数组——zip、zipwith
摘要: 1. let f = {}; f.flip = (fn)=>(...args)=>fn(...args.reverse()); var divide = (a,b)=>a / b; var flip = f.flip(divide); flip(10, 5) // 0.5 flip(1, 10) /
阅读全文
posted @ 2021-11-11 12:49 懒惰的星期六
阅读(110)
评论(0)
推荐(0)
JavaScript函数与创建对象
摘要: 1. 通过new的方式创建对象,自己会返回一个对象 function person(firstname, lastname, age, eyecolor) { this.firstname = firstname; this.lastname = lastname; this.age = age;
阅读全文
posted @ 2021-11-11 12:31 懒惰的星期六
阅读(59)
评论(0)
推荐(0)
Object.keys——Object.getOwnPropertyNames——对象.hasOwnProperty
摘要: 1. // console.log(Object.keys(p.prototype)) // 报错console.log(Object.keys(p))//['x', 'y']console.log(Object.keys(Point.prototype))//['fun1', 'fun2']con
阅读全文
posted @ 2021-11-11 12:29 懒惰的星期六
阅读(40)
评论(0)
推荐(0)
async/wait使用fetch 与generator使用fetch
摘要: 1. // Example POST method implementation: async function postData(url='15479453.html', data={}) { // Default options are marked with * const response
阅读全文
posted @ 2021-11-11 11:12 懒惰的星期六
阅读(105)
评论(0)
推荐(0)
上一页
1
···
12
13
14
15
16
17
18
19
20
···
29
下一页
公告
Welcome to here
主页