小白1d
小白1d
全部文章
分类
剑指offer(1)
题解(14)
归档
标签
去牛客网
登录
/
注册
小白1d的博客
全部文章
(共14篇)
题解 | #移除数组中的元素#
删除数组中元素 要反向循环,因为splice删除操作会移动数组下标 function removeWithoutCopy(arr, item) { let len = arr.length while(len--){ if(arr[len] === item ){ ...
2021-07-17
0
324
题解 | #字符串字符统计#
for of 迭代可迭代对象 function count(str) { const m = {} for(let k of str){ if(k === ' ') continue if(k in m){ m[k]++ ...
2021-07-17
24
1128
题解 | #将字符串转换为驼峰格式#
function cssStyle2DomStyle(sName) { return sName.replace(/^-{1}/g,'').replace(/-(\w{1})/g,function(m,p){ return p.toUpperCase() }) }
2021-07-17
0
288
题解 | #时间格式化输出#
function formatDate(date, fmt){ let dateObj = new Date(date) let year = dateObj.getFullYear() let month = dateObj.getMonth() + 1 let d...
2021-07-17
0
391
首页
上一页
1
2
下一页
末页