摘要: for...in index for...of item forEach index,item,all filter index,item,all return 新数组,原数组不变(1层的情况) map index,item,all some index,item,all every index,i 阅读全文
posted @ 2020-04-16 10:06 Yo! 阅读(272) 评论(0) 推荐(0) 编辑
摘要: let k = true; k && fn() if(k) { fn() } 1、柯里化:https://www.jianshu.com/p/2975c25e4d71 2.1、防抖 <script> function debounce(fn,delay){ let timer = null // 借 阅读全文
posted @ 2020-04-16 10:02 Yo! 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 一、获取时间戳 new Date().getTime() //ES5获取当前时间戳,13位毫秒new Date().valueOf() Date.now() // ES6获取当前时间戳 二、功能 ①、时间戳转日期格式 /* *1. 时间戳转日期格式 *如:10或13位 => '2020-2-21 1 阅读全文
posted @ 2020-04-16 09:56 Yo! 阅读(588) 评论(0) 推荐(0) 编辑
摘要: > 防止对象之前未定义(可用于是否缓存判断,后端传值是否是空,阻断for等遍历条件)(可防止空对象下面对象的属性报错) > throw 抛出错误,类return(阻断for等遍历条件,配合try...catch); - 判断是否存在b对象 -- 方法1 ``` try { b.a = 10 cons 阅读全文
posted @ 2020-04-16 09:47 Yo! 阅读(165) 评论(0) 推荐(0) 编辑