会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
炫冰G爱
博客园
首页
新随笔
联系
订阅
管理
2020年5月9日
数组生成树形结构
摘要: 数组生成树型结构
阅读全文
posted @ 2020-05-09 10:19 炫冰G爱
阅读(998)
评论(0)
推荐(0)
2019年10月28日
js 对象全等判断
摘要: 原文链接:https://juejin.im/post/5da1a04ae51d45783d6122bf
阅读全文
posted @ 2019-10-28 16:32 炫冰G爱
阅读(983)
评论(0)
推荐(0)
2019年5月27日
格式化形如 /data/{id}/abc/{path}的url,结果返回类似/data/1/abc/123
摘要: const formatUrl = (url: string, path: object) => { const reg = new RegExp(/\{(\w+)\}/, "g"); return url.replace(reg, ($0: any, $1: any) => { return pa
阅读全文
posted @ 2019-05-27 16:40 炫冰G爱
阅读(225)
评论(0)
推荐(0)
2018年12月28日
js实现上移和下移
摘要: class Utils { swapArray(arr, index1, index2) { arr[index1] = arr.splice(index2, 1, arr[index1])[0]; return arr; }, // 上移 将当前数组index索引与后面一个元素互换位置,向数组后面移动一位 moveUp(arr, ind...
阅读全文
posted @ 2018-12-28 19:08 炫冰G爱
阅读(4052)
评论(0)
推荐(0)
js动态创建隐藏的form表单
摘要: function makeForm() { // 创建一个 form const tempForm = document.createElement("form"); tempForm.id = "tempForm"; tempForm.name = "tempForm"; // 添加到 body 中 document.body.appendChi...
阅读全文
posted @ 2018-12-28 19:03 炫冰G爱
阅读(4402)
评论(0)
推荐(0)
2018年7月30日
js scrollTop匀速滚动
摘要: //匀速滚动function scroll(s,t){ let sp = 10/也可根据当前scrollTop动态改变sp的值,从而实现加速和减速滚动的效果 let cont = Number.parseInt(t / sp) let oneLong = s / cont let timer = setInterval(()=>{ console.log(cont) if(con...
阅读全文
posted @ 2018-07-30 10:27 炫冰G爱
阅读(3783)
评论(0)
推荐(0)
2018年5月8日
浅拷贝和深拷贝
摘要: 1.数组的拷贝(二维数组的拷贝(深拷贝)方法,请看到最后。。。) //一纬数组,通过slice、concat,Array.from()方法可以实现 var arr1 = [1, 2], arr2 = arr1.slice(); console.log(arr1); //[1, 2] console.
阅读全文
posted @ 2018-05-08 09:20 炫冰G爱
阅读(341)
评论(0)
推荐(0)
2018年5月7日
闭包问题
摘要: //以下打印结果是5 var arr = [1,2,3,4,5] for(var i = 0; i < arr.length; i++){ arr[i] = function(){ alert(i) } } arr[1]() //一下打印结果是 1(使用了闭包) var arr = [1,2,3,4,5] for(var i = 0; i < arr.length; i++){ ...
阅读全文
posted @ 2018-05-07 14:12 炫冰G爱
阅读(170)
评论(0)
推荐(0)
2018年5月2日
常用正则记录
摘要: 1、var s1 = "get-element-by-id"; 给定这样一个连字符串,写一个function转换为驼峰命名法形式的字符串 getElementById 2、判断字符串是否包含数字 3、判断电话号码 4、判断是否符合指定格式 给定字符串str,检查其是否符合如下格式 5、判断是否符合U
阅读全文
posted @ 2018-05-02 17:43 炫冰G爱
阅读(232)
评论(0)
推荐(0)
2018年4月26日
js字符串编码和unicode编码互转
摘要: //字符串编码转为unicode编码 //unicode编码转为字符串编码
阅读全文
posted @ 2018-04-26 13:04 炫冰G爱
阅读(19667)
评论(0)
推荐(0)
下一页
公告