jefferyho
jefferyho
全部文章
分类
题解(5)
归档
标签
去牛客网
登录
/
注册
jefferyho的博客
全部文章
(共5篇)
题解 | #获取指定字符串#
// 三个连续的数字 function getThreeConNums(num) { let numsArr = num.toString().match(/\d+/g); let flag = false; while(numsArr.length > 0 &&a...
HTML/CSS/JavaScript
2021-11-08
0
217
reduce
function remove(arr, item) { return arr.reduce((p, c) => { c !== item && p.push(c); return p; }, []) }
2021-03-10
0
398
判断连续三个数字
// 连续三个数字 function captureThreeNumbers(str) { let nums = str.match(/\d{3}/); return (nums || nums[0]) || false; } // 三个连续数字 function capture...
2021-02-23
4
958
找出数组 arr 中重复出现过的元素
function duplicates(arr) { return arr.reduce((prev, current, index, arrs) => { if(arrs.lastIndexOf(current) !== index && !prev....
2021-02-23
1
454
rgb2hex
function rgb2hex(sRGB) { function getHex(str) { let num = Number(str).toString(16); return num.length < 2 ? '0' + num : num; ...
2021-02-22
0
490