会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
weimiu
博客园
首页
新随笔
联系
订阅
管理
2023年8月22日
js数组操作的shift unshift pop push用法
摘要: Array.shift()shift() 方法用在数组上, 移除数组的第一个元素并返回移除的元素. 该方法会改变原数组的长度.const array1 = [1, 2, 3];const firstElement = array1.shift();console.log(array1); // Ex
阅读全文
posted @ 2023-08-22 10:58 weimiu
阅读(177)
评论(0)
推荐(0)
2023年8月21日
console的几个常用用法
摘要: console.log() 其一、主要表示:向 Web 控制台输出一条消息; 其二、而具体是什么信息就以传递的实参为准,然后就是在控制台就能显示自己传递参数的结果; console.log([1,3,5,7]) // 输出 [1, 3, 5, 7]console.log({}) // 输出 {}co
阅读全文
posted @ 2023-08-21 16:06 weimiu
阅读(103)
评论(0)
推荐(0)
js计算一串数字最长子链长度
摘要: 假设有一串字符串"186 186 150 200 160 130 197 200";现在求它的最长升序子串长度。let str ="186 186 150 200 160 130 197 200";let arr = str.split(" "); // 转化为数组let arrLeft = [];
阅读全文
posted @ 2023-08-21 14:45 weimiu
阅读(46)
评论(0)
推荐(0)
字符大小写及ASCII码转化方法
摘要: 大小写转化:("HelloWorld").toLowerCase(); // helloworld("HelloWorld").toUpperCase(); // HELLOWORLD字符与ASCII码: ("A").charCodeAt(); // 65String.fromCharCode(65
阅读全文
posted @ 2023-08-21 13:53 weimiu
阅读(165)
评论(0)
推荐(0)
进制转换
摘要: 通过toString将数字转化为对应进制的字符串:var num = 12;num.toString(2); //转换成二进制 1100num.toString(8); //转换成八进制 14num.toString(16); //转换成十六进制 c通过parseInt将数字字符按指定的进制转化为十
阅读全文
posted @ 2023-08-21 13:22 weimiu
阅读(29)
评论(0)
推荐(0)
公告